1// Copyright (c) 1999, Google Inc. 2// All rights reserved. 3// 4// Redistribution and use in source and binary forms, with or without 5// modification, are permitted provided that the following conditions are 6// met: 7// 8// * Redistributions of source code must retain the above copyright 9// notice, this list of conditions and the following disclaimer. 10// * Redistributions in binary form must reproduce the above 11// copyright notice, this list of conditions and the following disclaimer 12// in the documentation and/or other materials provided with the 13// distribution. 14// * Neither the name of Google Inc. nor the names of its 15// contributors may be used to endorse or promote products derived from 16// this software without specific prior written permission. 17// 18// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 30// --- 31// 32// Revamped and reorganized by Craig Silverstein 33// 34// This is the file that should be included by any file which declares 35// command line flag. 36 37#ifndef GFLAGS_DECLARE_H_ 38#define GFLAGS_DECLARE_H_ 39 40#include <string> 41#if @ac_cv_have_stdint_h@ 42#include <stdint.h> // the normal place uint16_t is defined 43#endif 44#if @ac_cv_have_systypes_h@ 45#include <sys/types.h> // the normal place u_int16_t is defined 46#endif 47#if @ac_cv_have_inttypes_h@ 48#include <inttypes.h> // a third place for uint16_t or u_int16_t 49#endif 50 51@ac_google_start_namespace@ 52#if @ac_cv_have_uint16_t@ // the C99 format 53typedef int32_t int32; 54typedef uint32_t uint32; 55typedef int64_t int64; 56typedef uint64_t uint64; 57#elif @ac_cv_have_u_int16_t@ // the BSD format 58typedef int32_t int32; 59typedef u_int32_t uint32; 60typedef int64_t int64; 61typedef u_int64_t uint64; 62#elif @ac_cv_have___int16@ // the windows (vc7) format 63typedef __int32 int32; 64typedef unsigned __int32 uint32; 65typedef __int64 int64; 66typedef unsigned __int64 uint64; 67#else 68#error Do not know how to define a 32-bit integer quantity on your system 69#endif 70@ac_google_end_namespace@ 71 72 73#define GFLAGS_DLL_DECLARE_FLAG /* rewritten to be non-empty in windows dir */ 74 75namespace fLS { 76 77// The meaning of "string" might be different between now and when the 78// macros below get invoked (e.g., if someone is experimenting with 79// other string implementations that get defined after this file is 80// included). Save the current meaning now and use it in the macros. 81typedef std::string clstring; 82 83} 84 85#define DECLARE_VARIABLE(type, shorttype, name) \ 86 /* We always want to import declared variables, dll or no */ \ 87 namespace fL##shorttype { extern GFLAGS_DLL_DECLARE_FLAG type FLAGS_##name; } \ 88 using fL##shorttype::FLAGS_##name 89 90#define DECLARE_bool(name) \ 91 DECLARE_VARIABLE(bool, B, name) 92 93#define DECLARE_int32(name) \ 94 DECLARE_VARIABLE(@ac_google_namespace@::int32, I, name) 95 96#define DECLARE_int64(name) \ 97 DECLARE_VARIABLE(@ac_google_namespace@::int64, I64, name) 98 99#define DECLARE_uint64(name) \ 100 DECLARE_VARIABLE(@ac_google_namespace@::uint64, U64, name) 101 102#define DECLARE_double(name) \ 103 DECLARE_VARIABLE(double, D, name) 104 105#define DECLARE_string(name) \ 106 namespace fLS { \ 107 using ::fLS::clstring; \ 108 extern GFLAGS_DLL_DECLARE_FLAG ::fLS::clstring& FLAGS_##name; \ 109 } \ 110 using fLS::FLAGS_##name 111 112#endif // GFLAGS_DECLARE_H_ 113