Changeset 1310 in Sophya for trunk/SophyaLib/BaseTools/mutyv.cc
- Timestamp:
- Nov 9, 2000, 4:39:19 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/BaseTools/mutyv.cc
r1225 r1310 38 38 { 39 39 typ = a.typ; iv = a.iv; dv = a.dv; dv_im = a.dv_im; 40 if (typ == 'S') strv = new string(*(a.strv));40 if (typ == MTVString) strv = new string(*(a.strv)); 41 41 else strv = NULL; 42 42 } … … 51 51 MuTyV::MuTyV(char const* s) 52 52 { 53 typ = 'S';53 typ = MTVString; 54 54 strv = new string(s); 55 55 mutyv_decodestr(s, dv, dv_im); … … 60 60 MuTyV::MuTyV(string const& s) 61 61 { 62 typ = 'S';62 typ = MTVString; 63 63 strv = new string(s); 64 64 mutyv_decodestr(s.c_str(), dv, dv_im); … … 70 70 { 71 71 typ = a.typ; iv = a.iv; dv = a.dv; dv_im = a.dv_im; 72 if (typ == 'S') {72 if (typ == MTVString) { 73 73 if (strv) *strv = *(a.strv); 74 74 else strv = new string(*(a.strv)); … … 80 80 char * MuTyV::operator= (char* s) 81 81 { 82 typ = 'S';82 typ = MTVString; 83 83 if (strv) *strv = s; 84 84 else strv = new string(s); … … 91 91 string & MuTyV::operator= (string& s) 92 92 { 93 typ = 'S';93 typ = MTVString; 94 94 if (strv) *strv = s; 95 95 else strv = new string(s); … … 102 102 MuTyV::operator string() const 103 103 { 104 if (typ == 'S') return(*strv);104 if (typ == MTVString) return(*strv); 105 105 else { 106 106 char buff[96]; 107 if (typ == 'I') sprintf(buff,"%ld", (long)iv);108 else if (typ == 'D') sprintf(buff,"%.20g", dv);109 else if (typ == 'Z') sprintf(buff,"(%.20g , %.20g)", dv, dv_im);107 if (typ == MTVInteger) sprintf(buff,"%ld", (long)iv); 108 else if (typ == MTVFloat) sprintf(buff,"%.20g", dv); 109 else if (typ == MTVComplex) sprintf(buff,"(%.20g , %.20g)", dv, dv_im); 110 110 else buff[0] = '\0'; 111 111 return(string(buff));
Note:
See TracChangeset
for help on using the changeset viewer.