Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: base/scoped_bstr_win.h

Issue 200045: Use Scoped[Bstr,ComPtr,Variant] instead of their ATL equivalents to reduce de... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_SCOPED_BSTR_WIN_H_ 5 #ifndef BASE_SCOPED_BSTR_WIN_H_
6 #define BASE_SCOPED_BSTR_WIN_H_ 6 #define BASE_SCOPED_BSTR_WIN_H_
7 7
8 #include "base/basictypes.h" // needed to pick up OS_WIN
9
10 #include "base/logging.h"
11
12 #include <windows.h> 8 #include <windows.h>
13 #include <oleauto.h> 9 #include <oleauto.h>
14 10
11 #include "base/logging.h"
12
15 // Manages a BSTR string pointer. 13 // Manages a BSTR string pointer.
16 // The class interface is based on scoped_ptr. 14 // The class interface is based on scoped_ptr.
17 class ScopedBstr { 15 class ScopedBstr {
18 public: 16 public:
19 ScopedBstr() : bstr_(NULL) { 17 ScopedBstr() : bstr_(NULL) {
20 } 18 }
21 19
22 // Constructor to create a new BSTR. 20 // Constructor to create a new BSTR.
23 // NOTE: Do not pass a BSTR to this constructor expecting ownership to 21 // NOTE: Do not pass a BSTR to this constructor expecting ownership to
24 // be transferred - even though it compiles! ;-) 22 // be transferred - even though it compiles! ;-)
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 // (e.g. if the BSTR is used inside a loop or more than one place), 132 // (e.g. if the BSTR is used inside a loop or more than one place),
135 // use StackBstrVar to declare a variable. 133 // use StackBstrVar to declare a variable.
136 // Example: 134 // Example:
137 // StackBstrVar(L"my_property", myprop); 135 // StackBstrVar(L"my_property", myprop);
138 // for (int i = 0; i < objects.length(); ++i) 136 // for (int i = 0; i < objects.length(); ++i)
139 // ProcessValue(objects[i].GetProp(myprop)); // GetProp accepts BSTR 137 // ProcessValue(objects[i].GetProp(myprop)); // GetProp accepts BSTR
140 #define StackBstrVar(str, var) \ 138 #define StackBstrVar(str, var) \
141 StackBstrT<sizeof(str)> var(str) 139 StackBstrT<sizeof(str)> var(str)
142 140
143 #endif // BASE_SCOPED_BSTR_WIN_H_ 141 #endif // BASE_SCOPED_BSTR_WIN_H_
OLDNEW
« no previous file with comments | « no previous file | base/scoped_variant_win.h » ('j') | chrome/browser/history/history_publisher_win.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698