1// -*- mode: C++ -*-
2
3// Copyright (c) 2012, Google Inc.
4// All rights reserved.
5//
6// Redistribution and use in source and binary forms, with or without
7// modification, are permitted provided that the following conditions are
8// met:
9//
10// * Redistributions of source code must retain the above copyright
11// notice, this list of conditions and the following disclaimer.
12// * Redistributions in binary form must reproduce the above
13// copyright notice, this list of conditions and the following disclaimer
14// in the documentation and/or other materials provided with the
15// distribution.
16// * Neither the name of Google Inc. nor the names of its
17// contributors may be used to endorse or promote products derived from
18// this software without specific prior written permission.
19//
20// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
32// Original author: Ivan Penkov
33
34// using_std_string.h: Allows building this code in environments where
35// global string (::string) exists.
36//
37// The problem:
38// -------------
39// Let's say you want to build this code in an environment where a global
40// string type is defined (i.e. ::string). Now, let's suppose that ::string
41// is different that std::string and you'd like to have the option to easily
42// choose between the two string types. Ideally you'd like to control which
43// string type is chosen by simply #defining an identifier.
44//
45// The solution:
46// -------------
47// #define HAS_GLOBAL_STRING somewhere in a global header file and then
48// globally replace std::string with string. Then include this header
49// file everywhere where string is used. If you want to revert back to
50// using std::string, simply remove the #define (HAS_GLOBAL_STRING).
51
52#ifndef THIRD_PARTY_BREAKPAD_SRC_COMMON_USING_STD_STRING_H_
53#define THIRD_PARTY_BREAKPAD_SRC_COMMON_USING_STD_STRING_H_
54
55#ifdef HAS_GLOBAL_STRING
56 typedef ::string google_breakpad_string;
57#else
58#include <string>
59 using std::string;
60 typedef std::string google_breakpad_string;
61#endif
62
63// Inicates that type google_breakpad_string is defined
64#define HAS_GOOGLE_BREAKPAD_STRING
65
66#endif // THIRD_PARTY_BREAKPAD_SRC_COMMON_USING_STD_STRING_H_
67