Use smart pointer for everything
This commit is contained in:
parent
1b9c9e40e3
commit
6b9371c4cd
6 changed files with 240 additions and 268 deletions
36
brightray/browser/win/scoped_hstring.h
Normal file
36
brightray/browser/win/scoped_hstring.h
Normal file
|
@ -0,0 +1,36 @@
|
|||
// Copyright (c) 2015 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE-CHROMIUM file.
|
||||
|
||||
#ifndef BRIGHTRAY_BROWSER_WIN_SCOPED_HSTRING_H_
|
||||
#define BRIGHTRAY_BROWSER_WIN_SCOPED_HSTRING_H_
|
||||
|
||||
#include <hstring.h>
|
||||
#include <windows.h>
|
||||
|
||||
#include "base/basictypes.h"
|
||||
|
||||
class ScopedHString {
|
||||
public:
|
||||
// Copy from |source|.
|
||||
ScopedHString(const wchar_t* source);
|
||||
// Create empty string.
|
||||
ScopedHString();
|
||||
~ScopedHString();
|
||||
|
||||
// Sets to |source|.
|
||||
void Set(const wchar_t* source);
|
||||
|
||||
// Returns string.
|
||||
operator HSTRING() const { return str_; }
|
||||
|
||||
// Whether there is a string created.
|
||||
bool success() const { return str_; }
|
||||
|
||||
private:
|
||||
HSTRING str_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(ScopedHString);
|
||||
};
|
||||
|
||||
#endif // BRIGHTRAY_BROWSER_WIN_SCOPED_HSTRING_H_
|
Loading…
Add table
Add a link
Reference in a new issue