00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00049 #ifndef PANTHEIOS_INCL_PANTHEIOS_INSERTERS_HPP_INTEGER
00050 #define PANTHEIOS_INCL_PANTHEIOS_INSERTERS_HPP_INTEGER
00051
00052
00053
00054
00055
00056 #ifndef PANTHEIOS_DOCUMENTATION_SKIP_SECTION
00057 # define PANTHEIOS_VER_PANTHEIOS_INSERTERS_HPP_INTEGER_MAJOR 2
00058 # define PANTHEIOS_VER_PANTHEIOS_INSERTERS_HPP_INTEGER_MINOR 5
00059 # define PANTHEIOS_VER_PANTHEIOS_INSERTERS_HPP_INTEGER_REVISION 5
00060 # define PANTHEIOS_VER_PANTHEIOS_INSERTERS_HPP_INTEGER_EDIT 36
00061 #endif
00062
00063
00064
00065
00066
00067 #ifndef PANTHEIOS_INCL_PANTHEIOS_H_PANTHEIOS
00068 # include <pantheios/pantheios.h>
00069 #endif
00070 #ifndef PANTHEIOS_INCL_PANTHEIOS_INSERTERS_HPP_FMT
00071 # include <pantheios/inserters/fmt.hpp>
00072 #endif
00073
00074 #ifndef STLSOFT_INCL_STLSOFT_SHIMS_ACCESS_STRING_H_FWD
00075 # include <stlsoft/shims/access/string/fwd.h>
00076 #endif
00077
00078
00079
00080
00081
00082 #if !defined(PANTHEIOS_NO_NAMESPACE)
00083 namespace pantheios
00084 {
00085
00086 #endif
00087
00088
00089
00090
00091
00125 class integer
00126 {
00129 public:
00130 typedef integer class_type;
00132
00135 private:
00136 size_t init_(::stlsoft::sint8_t i);
00137 size_t init_(::stlsoft::uint8_t i);
00138 size_t init_(::stlsoft::sint16_t i);
00139 size_t init_(::stlsoft::uint16_t i);
00140 size_t init_(::stlsoft::sint32_t i);
00141 size_t init_(::stlsoft::uint32_t i);
00142 #ifdef STLSOFT_CF_64BIT_INT_SUPPORT
00143 size_t init_(::stlsoft::sint64_t i);
00144 size_t init_(::stlsoft::uint64_t i);
00145 #endif
00146 #ifdef STLSOFT_CF_INT_DISTINCT_INT_TYPE
00147 size_t init_(int i);
00148 size_t init_(unsigned int i);
00149 #endif
00150 #ifdef STLSOFT_CF_LONG_DISTINCT_INT_TYPE
00151 size_t init_(long i);
00152 size_t init_(unsigned long i);
00153 #endif
00155
00158 public:
00163 explicit integer(::stlsoft::sint8_t i, int widthAndFormat);
00168 explicit integer(::stlsoft::uint8_t i, int widthAndFormat);
00173 explicit integer(::stlsoft::sint16_t i, int widthAndFormat);
00178 explicit integer(::stlsoft::uint16_t i, int widthAndFormat);
00183 explicit integer(::stlsoft::sint32_t i, int widthAndFormat);
00188 explicit integer(::stlsoft::uint32_t i, int widthAndFormat);
00189 #ifdef STLSOFT_CF_64BIT_INT_SUPPORT
00194 explicit integer(::stlsoft::sint64_t i, int widthAndFormat);
00199 explicit integer(::stlsoft::uint64_t i, int widthAndFormat);
00200 #endif
00201 #ifdef STLSOFT_CF_INT_DISTINCT_INT_TYPE
00206 explicit integer(int i, int widthAndFormat);
00211 explicit integer(unsigned int i, int widthAndFormat);
00212 #endif
00213 #ifdef STLSOFT_CF_LONG_DISTINCT_INT_TYPE
00218 explicit integer(long i, int widthAndFormat);
00223 explicit integer(unsigned long i, int widthAndFormat);
00224 #endif
00225
00227 explicit integer(::stlsoft::sint8_t i);
00229 explicit integer(::stlsoft::uint8_t i);
00231 explicit integer(::stlsoft::sint16_t i);
00233 explicit integer(::stlsoft::uint16_t i);
00235 explicit integer(::stlsoft::sint32_t i);
00237 explicit integer(::stlsoft::uint32_t i);
00238 #ifdef STLSOFT_CF_64BIT_INT_SUPPORT
00240 explicit integer(::stlsoft::sint64_t i);
00242 explicit integer(::stlsoft::uint64_t i);
00243 #endif
00244 #ifdef STLSOFT_CF_INT_DISTINCT_INT_TYPE
00246 explicit integer(int i);
00248 explicit integer(unsigned int i);
00249 #endif
00250 #ifdef STLSOFT_CF_LONG_DISTINCT_INT_TYPE
00252 explicit integer(long i);
00254 explicit integer(unsigned long i);
00255 #endif
00256
00263 explicit integer(::stlsoft::sint8_t i, int minWidth, int format);
00270 explicit integer(::stlsoft::uint8_t i, int minWidth, int format);
00277 explicit integer(::stlsoft::sint16_t i, int minWidth, int format);
00284 explicit integer(::stlsoft::uint16_t i, int minWidth, int format);
00291 explicit integer(::stlsoft::sint32_t i, int minWidth, int format);
00298 explicit integer(::stlsoft::uint32_t i, int minWidth, int format);
00299 #ifdef STLSOFT_CF_64BIT_INT_SUPPORT
00306 explicit integer(::stlsoft::sint64_t i, int minWidth, int format);
00313 explicit integer(::stlsoft::uint64_t i, int minWidth, int format);
00314 #endif
00315 #ifdef STLSOFT_CF_INT_DISTINCT_INT_TYPE
00322 explicit integer(int i, int minWidth, int format);
00329 explicit integer(unsigned int i, int minWidth, int format);
00330 #endif
00331 #ifdef STLSOFT_CF_LONG_DISTINCT_INT_TYPE
00338 explicit integer(long i, int minWidth, int format);
00345 explicit integer(unsigned long i, int minWidth, int format);
00346 #endif
00348
00351 public:
00353 pan_char_t const* data() const;
00355 pan_char_t const* c_str() const;
00357 size_t length() const;
00359
00362 private:
00363 void construct_() const;
00364 void construct_();
00365
00366 static int validate_width_(int minWidth);
00368
00371 private:
00372 union u
00373 {
00374 ::stlsoft::sint32_t s32;
00375 ::stlsoft::uint32_t u32;
00376 #ifdef STLSOFT_CF_64BIT_INT_SUPPORT
00377 ::stlsoft::sint64_t s64;
00378 ::stlsoft::uint64_t u64;
00379 #endif
00380 };
00381
00382 u m_value;
00383 size_t m_len;
00384 const int m_minWidth;
00385 const int m_format;
00386 pan_char_t m_sz[129];
00388
00391 private:
00392 #if !defined(STLSOFT_COMPILER_IS_GCC)
00393 integer(class_type const&);
00394 #endif
00395 class_type& operator =(class_type const&);
00397 };
00398
00399
00400
00401
00402
00403 #ifndef PANTHEIOS_DOCUMENTATION_SKIP_SECTION
00404
00405 # if !defined(PANTHEIOS_NO_NAMESPACE)
00406 namespace shims
00407 {
00408 # endif
00409
00411 # ifdef PANTHEIOS_USE_WIDE_STRINGS
00412 inline wchar_t const* c_str_data_w(integer const& i)
00413 # else
00414 inline char const* c_str_data_a(integer const& i)
00415 # endif
00416 {
00417 return i.data();
00418 }
00420 inline pan_char_t const* c_str_data(integer const& i)
00421 {
00422 return i.data();
00423 }
00424
00426 # ifdef PANTHEIOS_USE_WIDE_STRINGS
00427 inline size_t c_str_len_w(integer const& i)
00428 # else
00429 inline size_t c_str_len_a(integer const& i)
00430 # endif
00431 {
00432 return i.length();
00433 }
00435 inline size_t c_str_len(integer const& i)
00436 {
00437 return i.length();
00438 }
00439
00441 # ifdef PANTHEIOS_USE_WIDE_STRINGS
00442 inline wchar_t const* c_str_ptr_w(integer const& i)
00443 # else
00444 inline char const* c_str_ptr_a(integer const& i)
00445 # endif
00446 {
00447 return i.c_str();
00448 }
00450 inline pan_char_t const* c_str_ptr(integer const& i)
00451 {
00452 return i.c_str();
00453 }
00454
00455 # if !defined(PANTHEIOS_NO_NAMESPACE)
00456 }
00457
00458 # if defined(STLSOFT_COMPILER_IS_GCC)
00459
00460
00461
00462
00463
00464 # ifdef PANTHEIOS_USE_WIDE_STRINGS
00465 using ::pantheios::shims::c_str_data_w;
00466 using ::pantheios::shims::c_str_len_w;
00467 using ::pantheios::shims::c_str_ptr_w;
00468 # else
00469 using ::pantheios::shims::c_str_data_a;
00470 using ::pantheios::shims::c_str_len_a;
00471 using ::pantheios::shims::c_str_ptr_a;
00472 # endif
00473 using ::pantheios::shims::c_str_data;
00474 using ::pantheios::shims::c_str_len;
00475 using ::pantheios::shims::c_str_ptr;
00476 # endif
00477
00478 # endif
00479
00480 #endif
00481
00482
00483
00484
00485
00486 #if !defined(PANTHEIOS_NO_NAMESPACE)
00487 }
00488
00489 namespace stlsoft
00490 {
00491
00492
00493
00494
00495
00496
00497
00498 # ifdef PANTHEIOS_USE_WIDE_STRINGS
00499 using ::pantheios::shims::c_str_data_w;
00500 using ::pantheios::shims::c_str_len_w;
00501 using ::pantheios::shims::c_str_ptr_w;
00502 # else
00503 using ::pantheios::shims::c_str_data_a;
00504 using ::pantheios::shims::c_str_len_a;
00505 using ::pantheios::shims::c_str_ptr_a;
00506 # endif
00507 using ::pantheios::shims::c_str_data;
00508 using ::pantheios::shims::c_str_len;
00509 using ::pantheios::shims::c_str_ptr;
00510 }
00511
00512 #endif
00513
00514
00515
00516
00517
00518 #ifdef STLSOFT_PPF_pragma_once_SUPPORT
00519 # pragma once
00520 #endif
00521
00522
00523
00524 #endif
00525
00526