StandardTraits.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
  2. /******************************************************************************
  3. *
  4. * file: StandardTraits.h
  5. *
  6. * Copyright (c) 2007, Daniel Aarno, Michael E. Smoot .
  7. * Copyright (c) 2017, Google LLC
  8. * All rights reserved.
  9. *
  10. * See the file COPYING in the top directory of this distribution for
  11. * more information.
  12. *
  13. * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
  14. * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  16. * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  18. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  19. * DEALINGS IN THE SOFTWARE.
  20. *
  21. *****************************************************************************/
  22. // This is an internal tclap file, you should probably not have to
  23. // include this directly
  24. #ifndef TCLAP_STANDARD_TRAITS_H
  25. #define TCLAP_STANDARD_TRAITS_H
  26. #ifdef HAVE_CONFIG_H
  27. #include <config.h> // To check for long long
  28. #endif
  29. // If Microsoft has already typedef'd wchar_t as an unsigned
  30. // short, then compiles will break because it's as if we're
  31. // creating ArgTraits twice for unsigned short. Thus...
  32. #ifdef _MSC_VER
  33. #ifndef _NATIVE_WCHAR_T_DEFINED
  34. #define TCLAP_DONT_DECLARE_WCHAR_T_ARGTRAITS
  35. #endif
  36. #endif
  37. namespace TCLAP {
  38. // Integer types (signed, unsigned and bool) and floating point types all
  39. // have value-like semantics.
  40. // Strings have string like argument traits.
  41. template<>
  42. struct ArgTraits<std::string> {
  43. typedef StringLike ValueCategory;
  44. };
  45. template<typename T>
  46. void SetString(T &dst, const std::string &src)
  47. {
  48. dst = src;
  49. }
  50. } // namespace
  51. #endif