Planeshift
|
00001 // -*- mode: C++ -*- 00002 00003 // Copyright (c) 2012, Google Inc. 00004 // All rights reserved. 00005 // 00006 // Redistribution and use in source and binary forms, with or without 00007 // modification, are permitted provided that the following conditions are 00008 // met: 00009 // 00010 // * Redistributions of source code must retain the above copyright 00011 // notice, this list of conditions and the following disclaimer. 00012 // * Redistributions in binary form must reproduce the above 00013 // copyright notice, this list of conditions and the following disclaimer 00014 // in the documentation and/or other materials provided with the 00015 // distribution. 00016 // * Neither the name of Google Inc. nor the names of its 00017 // contributors may be used to endorse or promote products derived from 00018 // this software without specific prior written permission. 00019 // 00020 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00021 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00022 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00023 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00024 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00025 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00026 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00027 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00028 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00029 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00030 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00031 00032 // Original author: Ivan Penkov 00033 00034 // using_std_string.h: Allows building this code in environments where 00035 // global string (::string) exists. 00036 // 00037 // The problem: 00038 // ------------- 00039 // Let's say you want to build this code in an environment where a global 00040 // string type is defined (i.e. ::string). Now, let's suppose that ::string 00041 // is different that std::string and you'd like to have the option to easily 00042 // choose between the two string types. Ideally you'd like to control which 00043 // string type is chosen by simply #defining an identifier. 00044 // 00045 // The solution: 00046 // ------------- 00047 // #define HAS_GLOBAL_STRING somewhere in a global header file and then 00048 // globally replace std::string with string. Then include this header 00049 // file everywhere where string is used. If you want to revert back to 00050 // using std::string, simply remove the #define (HAS_GLOBAL_STRING). 00051 00052 #ifndef THIRD_PARTY_BREAKPAD_SRC_COMMON_USING_STD_STRING_H_ 00053 #define THIRD_PARTY_BREAKPAD_SRC_COMMON_USING_STD_STRING_H_ 00054 00055 #ifdef HAS_GLOBAL_STRING 00056 typedef ::string google_breakpad_string; 00057 #else 00058 using std::string; 00059 typedef std::string google_breakpad_string; 00060 #endif 00061 00062 // Inicates that type google_breakpad_string is defined 00063 #define HAS_GOOGLE_BREAKPAD_STRING 00064 00065 #endif // THIRD_PARTY_BREAKPAD_SRC_COMMON_USING_STD_STRING_H_