diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-29 21:54:42 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-29 21:54:42 +0000 |
commit | d546c48d90f0eaa592794f59e6a970b7b027db86 (patch) | |
tree | 44914e9ea575a25c544b0ec9bc0925e7c2f3f0ea /base/win | |
parent | eb86ce771f109d0cd3b20d68027f4f3628da03e6 (diff) | |
download | chromium_src-d546c48d90f0eaa592794f59e6a970b7b027db86.zip chromium_src-d546c48d90f0eaa592794f59e6a970b7b027db86.tar.gz chromium_src-d546c48d90f0eaa592794f59e6a970b7b027db86.tar.bz2 |
Move rgs_helper out of base to ceee since it's not used anywhere else.
TEST=it compiles
BUG=none
Review URL: http://codereview.chromium.org/6041007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70280 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/win')
-rw-r--r-- | base/win/rgs_helper.h | 89 |
1 files changed, 0 insertions, 89 deletions
diff --git a/base/win/rgs_helper.h b/base/win/rgs_helper.h deleted file mode 100644 index 16e33bf..0000000 --- a/base/win/rgs_helper.h +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) 2010 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 file. -// -// Defines a map for adding variables to rgs files. This allows COM object -// classes to declare the values of these variables so that we don't need to -// copy/paste them and manually keep them in sync. -// To use this, declare the registry ID of your RGS file using -// the DECLARE_REGISTRY_RESOURCEID_EX macro, instead of the -// DECLARE_REGISTRY_RESOURCEID, then add a registry map to your class -// using the registry map macros: -// BEGIN_REGISTRY_MAP(MyClassName) -// REGMAP_ENTRY("NAME", "MyClassName Class") -// REGMAP_ENTRY_UUID("CLSID", CLSID_MyClassName) -// END_REGISTRY_MAP() -// -// You can then refer to the names above in your RGS file as -// variables %NAME% and %CLSID%, respectively. -#ifndef BASE_WIN_RGS_HELPER_H_ -#define BASE_WIN_RGS_HELPER_H_ - -#include "base/string_util.h" - -struct ATLRegmapEntryHelper : public _ATL_REGMAP_ENTRY { - ATLRegmapEntryHelper() { - szKey = NULL; - szData = NULL; - } - ATLRegmapEntryHelper(LPCOLESTR key, LPCOLESTR data) { - szKey = key; - size_t size = lstrlen(data) + 1; - szData = new wchar_t[size]; - base::wcslcpy(const_cast<wchar_t*>(szData), data, size); - } - - ATLRegmapEntryHelper(LPCOLESTR key, UINT resid) { - wchar_t data[256] = {0}; - szKey = key; - if (::LoadString(_pModule->m_hInstResource, resid, data, - arraysize(data) - 1) == 0) { - *data = L'\0'; - } - - size_t size = lstrlen(data) + 1; - - szData = new wchar_t[size]; - base::wcslcpy(const_cast<wchar_t*>(szData), data, size); - } - - ATLRegmapEntryHelper(LPCOLESTR key, REFGUID guid) { - szKey = key; - static const size_t kGuidStringSize = 40; - szData = new wchar_t[kGuidStringSize]; - if (szData) { - if (::StringFromGUID2(guid, const_cast<LPOLESTR>(szData), - kGuidStringSize) == 0) { - *const_cast<LPOLESTR>(szData) = L'\0'; - } - } - } - ~ATLRegmapEntryHelper() { - delete [] szData; - } -}; - -#define BEGIN_REGISTRY_MAP(x)\ - static struct _ATL_REGMAP_ENTRY *_GetRegistryMap() {\ - static const ATLRegmapEntryHelper map[] = { -#define REGMAP_ENTRY(x, y) ATLRegmapEntryHelper(OLESTR(##x), OLESTR(##y)), - -#define REGMAP_UUID(x, clsid) ATLRegmapEntryHelper(OLESTR(##x), clsid), - -// This allows usage of a Resource string. -#define REGMAP_RESOURCE(x, resid) ATLRegmapEntryHelper(OLESTR(##x), resid), - -// This allows usage of a static function to be called to provide the string. -#define REGMAP_FUNCTION(x, f) ATLRegmapEntryHelper(OLESTR(##x), ##f()), - -#define END_REGISTRY_MAP() ATLRegmapEntryHelper() };\ - return (_ATL_REGMAP_ENTRY*)map;\ - } - -#define DECLARE_REGISTRY_RESOURCEID_EX(x)\ - static HRESULT WINAPI UpdateRegistry(BOOL bRegister) {\ - return ATL::_pAtlModule->UpdateRegistryFromResource((UINT)x, bRegister, \ - _GetRegistryMap());\ - } - -#endif // BASE_WIN_RGS_HELPER_H_ |