/* Copyright 2016 Google Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ #ifndef BASE_H_ #define BASE_H_ #include <cassert> #include <map> #include <string> #include <vector> namespace chrome_lang_id { vector; string; map; pair; uint32; #if LANG_CXX11 #define CLD3_DISALLOW_COPY_AND_ASSIGN … #else // C++98 case follows // Note that these C++98 implementations cannot completely disallow copying, // as members and friends can still accidentally make elided copies without // triggering a linker error. #define CLD3_DISALLOW_COPY_AND_ASSIGN(TypeName) … #endif // LANG_CXX11 #ifndef CLD3_IMMEDIATE_CRASH #if defined(__GNUC__) || defined(__clang__) #define CLD3_IMMEDIATE_CRASH() … #else #define CLD3_IMMEDIATE_CRASH … #endif #endif // CLD3_IMMEDIATE_CRASH #define CLD3_CHECK(f) … #if defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON) #define CLD3_DCHECK … #else #define CLD3_DCHECK(f) … #endif #ifndef SWIG int32; uint8; // NOLINT uint16; // NOLINT // A type to represent a Unicode code-point value. As of Unicode 4.0, // such values require up to 21 bits. // (For type-checking on pointers, make this explicitly signed, // and it should always be the signed version of whatever int32 is.) char32; #endif // SWIG #ifdef COMPILER_MSVC typedef __int64 int64; #else int64; // NOLINT #endif // COMPILER_MSVC #if defined(__GNUC__) && \ (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) // For functions we want to force inline. // Introduced in gcc 3.1. #define CLD3_ATTRIBUTE_ALWAYS_INLINE … #elif defined(_MSC_VER) #define CLD3_ATTRIBUTE_ALWAYS_INLINE … #else // Other compilers will have to figure it out for themselves. #define CLD3_ATTRIBUTE_ALWAYS_INLINE #endif #ifdef INTERNAL_BUILD typedef basic_string<char> bstring; #else bstring; #endif // INTERNAL_BUILD // Converts int64 to string. std::string Int64ToString(int64 input); } // namespace chrome_lang_id #endif // BASE_H_