Warning, /include/Geant4/tools/charp_out is written in an unsupported language. File is not indexed.
0001 // Copyright (C) 2010, Guy Barrand. All rights reserved.
0002 // See the file tools.license for terms.
0003
0004 #ifndef tools_charp_out
0005 #define tools_charp_out
0006
0007 #include "snpf"
0008 #include <string>
0009
0010 namespace tools {
0011
0012 class charp_out : public std::string {
0013 typedef std::string parent;
0014 public:
0015 charp_out(const char* a_value) {
0016 char _s[512];
0017 if(sizeof(unsigned long)==sizeof(char*)) { //majority of cases.
0018 snpf(_s,sizeof(_s),"%lu",a_value);
0019 parent::operator+=(_s);
0020 } else if(sizeof(unsigned long long)==sizeof(char*)) { //majority of cases.
0021 snpf(_s,sizeof(_s),"%llu",a_value);
0022 parent::operator+=(_s);
0023 } else {
0024 parent::operator+=("charp_out_failed");
0025 }
0026 }
0027 public:
0028 charp_out(const charp_out& a_from):parent(a_from){}
0029 charp_out& operator=(const charp_out& a_from){parent::operator=(a_from);return *this;}
0030 };
0031
0032 }
0033
0034 #endif