Namespace madness to get it to compile with gcc 3.0. Ah, 2.95 works too ;)
This commit is contained in:
@@ -74,7 +74,7 @@ gposixdir::~gposixdir()
|
||||
|
||||
void gposixdir::cd(const char *name, bool relative)
|
||||
{
|
||||
string ndirname;
|
||||
std::string ndirname;
|
||||
if(!*name)
|
||||
name = ".";
|
||||
if(relative) {
|
||||
@@ -115,7 +115,7 @@ const gdirentry *gposixdir::nextentry(const char *mask, bool nameonly)
|
||||
}
|
||||
ret.name = entries[last_entry];
|
||||
ret.dirname = dirname.c_str();
|
||||
string pn = ret.dirname;
|
||||
std::string pn = ret.dirname;
|
||||
pn += "/";
|
||||
pn += ret.name;
|
||||
size_t skipfrom;
|
||||
|
@@ -39,7 +39,7 @@
|
||||
class gdirentry {
|
||||
|
||||
public:
|
||||
string name;
|
||||
std::string name;
|
||||
struct stat stat_info;
|
||||
const char *dirname;
|
||||
gdirentry();
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
class gposixdir {
|
||||
|
||||
private:
|
||||
string dirname;
|
||||
std::string dirname;
|
||||
gdirentry ret;
|
||||
gstrarray entries;
|
||||
unsigned long last_entry;
|
||||
|
@@ -66,8 +66,8 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
vector<ops> ostk;
|
||||
vector<int> vstk;
|
||||
std::vector<ops> ostk;
|
||||
std::vector<int> vstk;
|
||||
|
||||
ops pop_operator();
|
||||
int pop_value();
|
||||
@@ -81,14 +81,14 @@ public:
|
||||
void push_operator(ops o);
|
||||
|
||||
int evaluate_op(ops o, int y, int x);
|
||||
int evaluate_ops(ops* o, int* y, int* x);
|
||||
int evaluate_ops(std::vector<ops>::iterator o, std::vector<int>::iterator y, std::vector<int>::iterator x);
|
||||
|
||||
};
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
inline int geval::evaluate_ops(ops* o, int* y, int* x) {
|
||||
inline int geval::evaluate_ops(std::vector<ops>::iterator o, std::vector<int>::iterator y, std::vector<int>::iterator x) {
|
||||
|
||||
return evaluate_op(*o, *y, *x);
|
||||
}
|
||||
|
@@ -26,6 +26,7 @@
|
||||
|
||||
#include <gdefs.h>
|
||||
#include <geval.h>
|
||||
#include <iterator>
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
@@ -50,8 +51,8 @@ int gevalhum::evaluate() {
|
||||
|
||||
while(ostk.size()) {
|
||||
|
||||
int* vptr = vstk.begin();
|
||||
ops* optr = ostk.begin();
|
||||
std::vector<int>::iterator vptr = vstk.begin();
|
||||
std::vector<ops>::iterator optr = ostk.begin();
|
||||
|
||||
while(optr < ostk.end()) {
|
||||
|
||||
|
@@ -254,7 +254,7 @@ int gfile::getftime(dword* __ftime) {
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
FILE* gfile::fopen(const string& __path, const char* __mode, int __shflag) {
|
||||
FILE* gfile::fopen(const std::string& __path, const char* __mode, int __shflag) {
|
||||
|
||||
return fopen(__path.c_str(), __mode, __shflag);
|
||||
}
|
||||
|
@@ -119,7 +119,7 @@ public:
|
||||
// ANSI-style streaming buffered I/O
|
||||
|
||||
FILE* fopen (const char* __path, const char* __mode, int __shflag=SH_DENYNO);
|
||||
FILE* fopen (const string& __path, const char* __mode, int __shflag=SH_DENYNO);
|
||||
FILE* fopen (const std::string& __path, const char* __mode, int __shflag=SH_DENYNO);
|
||||
FILE* fdopen (char* __mode);
|
||||
int fclose ();
|
||||
|
||||
|
@@ -129,38 +129,38 @@ struct Stamp {
|
||||
#endif
|
||||
|
||||
FILE* fsopen(const char* path, const char* type, int shflag);
|
||||
inline FILE* fsopen(const string& path, const char* type, int shflag) { return fsopen(path.c_str(), type, shflag); }
|
||||
inline FILE* fsopen(const std::string& path, const char* type, int shflag) { return fsopen(path.c_str(), type, shflag); }
|
||||
|
||||
int is_dir(const char* path);
|
||||
inline int is_dir(const string& path) { return is_dir(path.c_str()); }
|
||||
inline int is_dir(const std::string& path) { return is_dir(path.c_str()); }
|
||||
|
||||
inline bool fexist(const char* filename) { return *filename ? ((access(filename, 0) == 0) and not is_dir(filename)) : false; }
|
||||
inline bool fexist(const string& filename) { return fexist(filename.c_str()); }
|
||||
inline bool fexist(const std::string& filename) { return fexist(filename.c_str()); }
|
||||
|
||||
dword gfixstattime(time_t st_time);
|
||||
|
||||
dword GetFiletime(const char* file);
|
||||
inline dword GetFiletime(const string& file) { return GetFiletime(file.c_str()); }
|
||||
inline dword GetFiletime(const std::string& file) { return GetFiletime(file.c_str()); }
|
||||
|
||||
inline long FiletimeCmp(const char* file1, const char* file2) { return long(GetFiletime(file1) - GetFiletime(file2)); }
|
||||
inline long FiletimeCmp(const string& file1, const string& file2) { return FiletimeCmp(file1.c_str(), file2.c_str()); }
|
||||
inline long FiletimeCmp(const std::string& file1, const std::string& file2) { return FiletimeCmp(file1.c_str(), file2.c_str()); }
|
||||
|
||||
long fsize(FILE* fp);
|
||||
long GetFilesize(const char* file);
|
||||
|
||||
const char* AddPath(const char* path, const char* file);
|
||||
inline const char* AddPath(const string& path, const char* file) { return AddPath(path.c_str(), file); }
|
||||
inline const char* AddPath(const string& path, const string& file) { return AddPath(path.c_str(), file.c_str()); }
|
||||
inline const char* AddPath(const std::string& path, const char* file) { return AddPath(path.c_str(), file); }
|
||||
inline const char* AddPath(const std::string& path, const std::string& file) { return AddPath(path.c_str(), file.c_str()); }
|
||||
|
||||
void MakePathname(char* pathname, const char* path, const char* name);
|
||||
void MakePathname(string& pathname, const string& path, const string& name);
|
||||
void MakePathname(std::string& pathname, const std::string& path, const std::string& name);
|
||||
|
||||
char* AddBackslash(char* p);
|
||||
string& AddBackslash(string& p);
|
||||
std::string& AddBackslash(std::string& p);
|
||||
char* StripBackslash(char* p);
|
||||
|
||||
char* PathCopy(char* dst, const char* src);
|
||||
void PathCopy(string& dst, const char* src);
|
||||
void PathCopy(std::string& dst, const char* src);
|
||||
|
||||
void TouchFile(const char* __filename);
|
||||
|
||||
@@ -170,7 +170,7 @@ void WipeFile(const char* file, int options);
|
||||
const char* CleanFilename(const char* __file);
|
||||
|
||||
int strschg_environ(char* s);
|
||||
int strschg_environ(string& s);
|
||||
int strschg_environ(std::string& s);
|
||||
|
||||
char* MapPath(char* map, bool reverse = false);
|
||||
inline char* ReMapPath(char* map) { return MapPath(map, true); };
|
||||
@@ -243,7 +243,7 @@ inline int chsize(int handle, long size) { return ftruncate(handle, size); }
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
bool maketruepath(string &dirname);
|
||||
bool maketruepath(std::string &dirname);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
@@ -385,7 +385,7 @@ int strschg_environ(char* s) {
|
||||
if(*s == NUL)
|
||||
return 0;
|
||||
|
||||
string __s = s;
|
||||
std::string __s = s;
|
||||
int rv = strschg_environ(__s);
|
||||
if(rv)
|
||||
strxcpy(s, __s.c_str(), sizeof(Path));
|
||||
|
@@ -36,7 +36,7 @@
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
string& AddBackslash(string& p) {
|
||||
std::string& AddBackslash(std::string& p) {
|
||||
|
||||
for(size_t posn = 0; (posn=p.find(GOLD_WRONG_SLASH_CHR, posn)) != p.npos; posn++)
|
||||
p[posn] = GOLD_SLASH_CHR;
|
||||
@@ -50,7 +50,7 @@ string& AddBackslash(string& p) {
|
||||
// ------------------------------------------------------------------
|
||||
// Add path to filename, if no path is set
|
||||
|
||||
void MakePathname(string& pathname, const string& path, const string& name) {
|
||||
void MakePathname(std::string& pathname, const std::string& path, const std::string& name) {
|
||||
|
||||
Path pn;
|
||||
MakePathname(pn, path.c_str(), name.c_str());
|
||||
@@ -60,7 +60,7 @@ void MakePathname(string& pathname, const string& path, const string& name) {
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
void PathCopy(string& dst, const char* src) {
|
||||
void PathCopy(std::string& dst, const char* src) {
|
||||
|
||||
dst = src;
|
||||
strschg_environ(dst);
|
||||
@@ -70,9 +70,9 @@ void PathCopy(string& dst, const char* src) {
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
int strschg_environ(string& s) {
|
||||
int strschg_environ(std::string& s) {
|
||||
|
||||
string fnd;
|
||||
std::string fnd;
|
||||
int replaced = 0;
|
||||
size_t posn, posn1;
|
||||
|
||||
@@ -86,7 +86,7 @@ int strschg_environ(string& s) {
|
||||
|
||||
#ifndef __HAVE_DRIVES__
|
||||
if(not s.empty() and (s[0] == '~')) {
|
||||
string name;
|
||||
std::string name;
|
||||
const char *p = s.c_str()+1;
|
||||
if((s.length() != 1) and not isslash(*p)) {
|
||||
while(*p and not isslash(*p))
|
||||
@@ -95,7 +95,7 @@ int strschg_environ(string& s) {
|
||||
name = getlogin();
|
||||
struct passwd *pe = getpwnam(name.c_str());
|
||||
if(pe != NULL) {
|
||||
string dirname = pe->pw_dir;
|
||||
std::string dirname = pe->pw_dir;
|
||||
dirname += "/";
|
||||
if(isslash(*p))
|
||||
++p;
|
||||
@@ -112,10 +112,10 @@ int strschg_environ(string& s) {
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
bool maketruepath(string &dirname) {
|
||||
bool maketruepath(std::string &dirname) {
|
||||
|
||||
bool ok = true;
|
||||
string ndirname;
|
||||
std::string ndirname;
|
||||
char cwd[GMAXPATH];
|
||||
getcwd(cwd, GMAXPATH);
|
||||
#ifdef __HAVE_DRIVES__
|
||||
|
@@ -91,7 +91,7 @@ char* ftn_addr::reset(const char* str, char* dom, int domsizelimit) {
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
void ftn_addr::reset(const string& str) {
|
||||
void ftn_addr::reset(const std::string& str) {
|
||||
|
||||
reset(str.c_str());
|
||||
}
|
||||
@@ -99,7 +99,7 @@ void ftn_addr::reset(const string& str) {
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
void ftn_addr::reset(const string& str, string& dom, int domsizelimit) {
|
||||
void ftn_addr::reset(const std::string& str, std::string& dom, int domsizelimit) {
|
||||
|
||||
ftn_domain doms;
|
||||
reset(str.c_str(), doms, domsizelimit);
|
||||
@@ -129,7 +129,7 @@ static bool ftn_getaddrpart(word& part, const char* s) {
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
const char* ftn_addr::set(const string& str) {
|
||||
const char* ftn_addr::set(const std::string& str) {
|
||||
|
||||
return set(str.c_str());
|
||||
}
|
||||
@@ -137,7 +137,7 @@ const char* ftn_addr::set(const string& str) {
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
const char* ftn_addr::set(const string& str, string& dom, int domsizelimit) {
|
||||
const char* ftn_addr::set(const std::string& str, std::string& dom, int domsizelimit) {
|
||||
|
||||
ftn_domain doms;
|
||||
set(str.c_str(), doms, domsizelimit);
|
||||
@@ -292,7 +292,7 @@ int ftn_addr::compare(const ftn_addr& other) const {
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
string& ftn_addr::make_string(string& str) const {
|
||||
std::string& ftn_addr::make_string(std::string& str) const {
|
||||
|
||||
char buf[200];
|
||||
make_string(buf);
|
||||
@@ -303,7 +303,7 @@ string& ftn_addr::make_string(string& str) const {
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
string& ftn_addr::make_string(string& str, const string& dom, int domfmt) const {
|
||||
std::string& ftn_addr::make_string(std::string& str, const std::string& dom, int domfmt) const {
|
||||
|
||||
char buf[200];
|
||||
make_string(buf, dom.c_str(), domfmt);
|
||||
|
@@ -80,7 +80,7 @@ public:
|
||||
ftn_addr() : zone(0), net(0), node(0), point(0) {}
|
||||
ftn_addr(uint a);
|
||||
ftn_addr(const char* s);
|
||||
ftn_addr(const string& s);
|
||||
ftn_addr(const std::string& s);
|
||||
ftn_addr(const ftn_addr& a);
|
||||
ftn_addr(uint zn, uint nt, uint nd, uint pt);
|
||||
|
||||
@@ -94,21 +94,21 @@ public:
|
||||
void set(const ftn_addr& a);
|
||||
void set(const void* a);
|
||||
char* set(const char* str, char* dom=NULL, int domsizelimit=ftn::domain_limit);
|
||||
const char* set(const string& str);
|
||||
const char* set(const string& str, string& dom, int domsizelimit=ftn::domain_limit);
|
||||
const char* set(const std::string& str);
|
||||
const char* set(const std::string& str, std::string& dom, int domsizelimit=ftn::domain_limit);
|
||||
|
||||
void reset();
|
||||
void reset_fast();
|
||||
void reset(const string& str);
|
||||
void reset(const std::string& str);
|
||||
char* reset(const char* str, char* dom=NULL, int domsizelimit=ftn::domain_limit);
|
||||
void reset(const string& str, string& dom, int domsizelimit=ftn::domain_limit);
|
||||
void reset(const std::string& str, std::string& dom, int domsizelimit=ftn::domain_limit);
|
||||
|
||||
bool match(const ftn_addr& mask) const;
|
||||
bool equals(const ftn_addr& other) const;
|
||||
int compare(const ftn_addr& other) const;
|
||||
|
||||
string& make_string(string& str) const;
|
||||
string& make_string(string& str, const string& dom, int domfmt=ftn::domain_last) const;
|
||||
std::string& make_string(std::string& str) const;
|
||||
std::string& make_string(std::string& str, const std::string& dom, int domfmt=ftn::domain_last) const;
|
||||
char* make_string(char* str, const char* dom=NULL, int domfmt=ftn::domain_last) const;
|
||||
|
||||
bool operator==(const ftn_addr& b) const;
|
||||
@@ -116,7 +116,7 @@ public:
|
||||
|
||||
ftn_addr& operator=(int n);
|
||||
ftn_addr& operator=(const char* s);
|
||||
ftn_addr& operator=(const string& s);
|
||||
ftn_addr& operator=(const std::string& s);
|
||||
ftn_addr& operator=(const ftn_addr& a);
|
||||
};
|
||||
|
||||
@@ -171,7 +171,7 @@ inline ftn_addr::ftn_addr(const char* s) : zone(0), net(0), node(0), point(0) {
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
inline ftn_addr::ftn_addr(const string& s) : zone(0), net(0), node(0), point(0) {
|
||||
inline ftn_addr::ftn_addr(const std::string& s) : zone(0), net(0), node(0), point(0) {
|
||||
|
||||
reset(s);
|
||||
}
|
||||
@@ -219,7 +219,7 @@ inline bool ftn_addr::operator!=(const ftn_addr& b) const { return !equals(b); }
|
||||
|
||||
inline ftn_addr& ftn_addr::operator=(int n) { set_all(n); return *this; }
|
||||
inline ftn_addr& ftn_addr::operator=(const char* s) { reset(s); return *this; }
|
||||
inline ftn_addr& ftn_addr::operator=(const string& s) { reset(s); return *this; }
|
||||
inline ftn_addr& ftn_addr::operator=(const std::string& s) { reset(s); return *this; }
|
||||
inline ftn_addr& ftn_addr::operator=(const ftn_addr& a) { set_fast(a); return *this; }
|
||||
|
||||
|
||||
|
@@ -87,7 +87,7 @@ void ftn_attr::add(const ftn_attr& b) {
|
||||
// ------------------------------------------------------------------
|
||||
// Create string representation of an attribute set
|
||||
|
||||
string& ftn_attr::make_string(string& s) const {
|
||||
std::string& ftn_attr::make_string(std::string& s) const {
|
||||
|
||||
s = "";
|
||||
|
||||
@@ -138,7 +138,7 @@ string& ftn_attr::make_string(string& s) const {
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
void ftn_attr::get(const string& __s) {
|
||||
void ftn_attr::get(const std::string& __s) {
|
||||
|
||||
const char *s = __s.c_str();
|
||||
if(striinc("PVT", s)) pvt1();
|
||||
|
@@ -124,19 +124,19 @@ public:
|
||||
|
||||
ftn_attr() { reset(); }
|
||||
ftn_attr(const char* s) { get(s); }
|
||||
ftn_attr(const string& s) { get(s); }
|
||||
ftn_attr(const std::string& s) { get(s); }
|
||||
ftn_attr(const ftn_attr& o) { operator=(o); }
|
||||
|
||||
void reset() { attr1 = attr2 = 0; }
|
||||
|
||||
void add(const ftn_attr& b);
|
||||
void get(const string& s);
|
||||
string& make_string(string& s) const;
|
||||
void get(const std::string& s);
|
||||
std::string& make_string(std::string& s) const;
|
||||
|
||||
bool equals(const ftn_attr& b) const;
|
||||
|
||||
ftn_attr& operator=(const char* s) { get(s); return *this; }
|
||||
ftn_attr& operator=(const string& s) { get(s); return *this; }
|
||||
ftn_attr& operator=(const std::string& s) { get(s); return *this; }
|
||||
ftn_attr& operator=(const ftn_attr& o) { attr1=o.attr1; attr2=o.attr2; return *this; }
|
||||
|
||||
bool operator==(const ftn_attr& b) const { return equals(b); }
|
||||
@@ -485,7 +485,7 @@ typedef ftn_attr Attr;
|
||||
|
||||
inline void AttrAdd(Attr* a, Attr* b) { a->add(*b); }
|
||||
inline void GetAttribstr(Attr* attr, const char* attrs) { attr->get(attrs); }
|
||||
inline char* MakeAttrStr(char* str, size_t maxlen, const Attr* attr) { string tmp; attr->make_string(tmp); strxcpy(str, tmp.c_str(), maxlen); return str; }
|
||||
inline char* MakeAttrStr(char* str, size_t maxlen, const Attr* attr) { std::string tmp; attr->make_string(tmp); strxcpy(str, tmp.c_str(), maxlen); return str; }
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
@@ -74,7 +74,7 @@ void gsearch::set_pattern(const char* a) {
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
bool gsearch::search(const string& str) {
|
||||
bool gsearch::search(const std::string& str) {
|
||||
|
||||
int discard_result;
|
||||
return search(str, discard_result);
|
||||
@@ -83,7 +83,7 @@ bool gsearch::search(const string& str) {
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
bool gsearch::search(const string& str, int& result) {
|
||||
bool gsearch::search(const std::string& str, int& result) {
|
||||
|
||||
return search(str.c_str(), result);
|
||||
}
|
||||
|
@@ -62,8 +62,8 @@ protected:
|
||||
public:
|
||||
|
||||
// Configuration
|
||||
string id;
|
||||
string pattern;
|
||||
std::string id;
|
||||
std::string pattern;
|
||||
patterntype type;
|
||||
bool case_sensitive;
|
||||
bool reverse;
|
||||
@@ -90,9 +90,9 @@ public:
|
||||
// Search a string for the pattern.
|
||||
// Return true for success, false for failure.
|
||||
bool search(const char* string);
|
||||
bool search(const string& str);
|
||||
bool search(const std::string& str);
|
||||
bool search(const char* str, int& result);
|
||||
bool search(const string& str, int& result);
|
||||
bool search(const std::string& str, int& result);
|
||||
|
||||
gsearch& operator=(const gsearch& a);
|
||||
|
||||
|
@@ -120,7 +120,7 @@ public:
|
||||
areas_all
|
||||
};
|
||||
|
||||
vector<search_item> items;
|
||||
std::vector<search_item> items;
|
||||
|
||||
search_direction direction;
|
||||
search_messages messages;
|
||||
|
@@ -37,7 +37,6 @@
|
||||
#include <cstring>
|
||||
#include <gdefs.h>
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
#if defined(__EMX__)
|
||||
@@ -70,7 +69,7 @@ char* strshr(char* str, int count);
|
||||
char* strsrep(char* str, const char* search, const char* replace);
|
||||
char* strltrim(char* str);
|
||||
char* strtrim(char* str);
|
||||
string& strtrim(string& p);
|
||||
std::string& strtrim(std::string& p);
|
||||
char* struplow(char* str);
|
||||
|
||||
char* longdotstr(long num); // Convert a long to a dotted string: xxx.xxx.xxx.xxx
|
||||
|
@@ -39,7 +39,7 @@
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
typedef vector<string> gstrarray;
|
||||
typedef std::vector<std::string> gstrarray;
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
@@ -451,10 +451,10 @@ char* strtrim(char* p) {
|
||||
}
|
||||
|
||||
|
||||
string& strtrim(string& p) {
|
||||
std::string& strtrim(std::string& p) {
|
||||
|
||||
if(not p.empty()) {
|
||||
string::iterator trail = p.end();
|
||||
std::string::iterator trail = p.end();
|
||||
while(trail != p.begin() and *(--trail) < '!') {}
|
||||
if(*trail > ' ') trail++;
|
||||
p.erase(trail, p.end());
|
||||
|
@@ -35,6 +35,7 @@
|
||||
#include <cstddef>
|
||||
#include <gdefs.h>
|
||||
#ifdef __UNIX__
|
||||
#include <unistd.h>
|
||||
#include <sys/times.h>
|
||||
#endif
|
||||
#ifdef __OS2__
|
||||
@@ -129,7 +130,7 @@ inline void usleep(long duration) { Sleep(duration); }
|
||||
#endif
|
||||
|
||||
#ifdef __UNIX__
|
||||
inline Clock gclock() { struct tms z; return Clock(times(&z)*10/CLK_TCK); }
|
||||
inline Clock gclock() { struct tms z; return Clock(times(&z)*10/sysconf(_SC_CLK_TCK)); }
|
||||
#else
|
||||
inline Clock gclock() { return Clock(clock()*10/CLK_TCK); }
|
||||
#endif
|
||||
|
@@ -50,7 +50,7 @@ Grp::Grp() {
|
||||
|
||||
Grp::~Grp() {
|
||||
|
||||
multimap<int, grp_stock>::iterator i;
|
||||
std::multimap<int, grp_stock>::iterator i;
|
||||
for(currgrp = container.begin(); currgrp != container.end(); currgrp++)
|
||||
for(i = currgrp->second.begin(); i != currgrp->second.end(); i++) {
|
||||
if(i->second.type == TYPE_OBJECT)
|
||||
@@ -66,10 +66,10 @@ Grp::~Grp() {
|
||||
|
||||
void Grp::AddGrp(const char* id) {
|
||||
|
||||
string sid(id);
|
||||
multimap<int, grp_stock> m;
|
||||
m.insert(pair<int, grp_stock>(GRP_MEMBER, sid));
|
||||
container.push_back(pair<string, multimap<int, grp_stock> >(sid, m));
|
||||
std::string sid(id);
|
||||
std::multimap<int, grp_stock> m;
|
||||
m.insert(std::pair<int, grp_stock>(GRP_MEMBER, sid));
|
||||
container.push_back(std::pair<std::string, std::multimap<int, grp_stock> >(sid, m));
|
||||
currgrp = container.end()-1;
|
||||
currgrpno = container.size()-1;
|
||||
}
|
||||
@@ -80,7 +80,7 @@ void Grp::AddGrp(const char* id) {
|
||||
|
||||
void Grp::AddMbr(const char* id) {
|
||||
|
||||
currgrp->second.insert(pair<int, grp_stock>(GRP_MEMBER, string(id)));
|
||||
currgrp->second.insert(std::pair<int, grp_stock>(GRP_MEMBER, std::string(id)));
|
||||
}
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ void Grp::AddMbr(const char* id) {
|
||||
|
||||
const char* Grp::SetGrp(const char* id) {
|
||||
|
||||
multimap<int, grp_stock>::iterator i;
|
||||
std::multimap<int, grp_stock>::iterator i;
|
||||
for(currgrp = container.begin(), currgrpno = 0; currgrp != container.end(); currgrp++, currgrpno++)
|
||||
for(i = currgrp->second.find(GRP_MEMBER); (i != currgrp->second.end()) and (i->first == GRP_MEMBER); i++)
|
||||
if(strwild(id, i->second.data.string_item->c_str()))
|
||||
@@ -102,7 +102,7 @@ const char* Grp::SetGrp(const char* id) {
|
||||
|
||||
void Grp::AddItm(int __type, bool __data) {
|
||||
|
||||
currgrp->second.insert(pair<int, grp_stock>(__type, __data));
|
||||
currgrp->second.insert(std::pair<int, grp_stock>(__type, __data));
|
||||
}
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ void Grp::AddItm(int __type, bool __data) {
|
||||
|
||||
void Grp::AddItm(int __type, char __data) {
|
||||
|
||||
currgrp->second.insert(pair<int, grp_stock>(__type, __data));
|
||||
currgrp->second.insert(std::pair<int, grp_stock>(__type, __data));
|
||||
}
|
||||
|
||||
|
||||
@@ -118,15 +118,15 @@ void Grp::AddItm(int __type, char __data) {
|
||||
|
||||
void Grp::AddItm(int __type, int __data) {
|
||||
|
||||
currgrp->second.insert(pair<int, grp_stock>(__type, __data));
|
||||
currgrp->second.insert(std::pair<int, grp_stock>(__type, __data));
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
void Grp::AddItm(int __type, const string& __data) {
|
||||
void Grp::AddItm(int __type, const std::string& __data) {
|
||||
|
||||
currgrp->second.insert(pair<int, grp_stock>(__type, __data));
|
||||
currgrp->second.insert(std::pair<int, grp_stock>(__type, __data));
|
||||
}
|
||||
|
||||
|
||||
@@ -137,7 +137,7 @@ void Grp::AddItm(int __type, void* __data, int __size) {
|
||||
void *data = throw_malloc(__size+sizeof(int));
|
||||
*((int *)data) = __size;
|
||||
memcpy((char *)data+sizeof(int), __data, __size);
|
||||
currgrp->second.insert(pair<int, grp_stock>(__type, data));
|
||||
currgrp->second.insert(std::pair<int, grp_stock>(__type, data));
|
||||
}
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ int Grp::GetItm(int __type, bool& __data, int __no) {
|
||||
if(rv) {
|
||||
if((__no >= rv) or (__no == -1))
|
||||
__no = rand() % rv;
|
||||
multimap<int, grp_stock>::iterator i = currgrp->second.find(__type);
|
||||
std::multimap<int, grp_stock>::iterator i = currgrp->second.find(__type);
|
||||
while(__no--) i++;
|
||||
__data = i->second.data.bool_item;
|
||||
}
|
||||
@@ -179,7 +179,7 @@ int Grp::GetItm(int __type, char& __data, int __no) {
|
||||
if(rv) {
|
||||
if((__no >= rv) or (__no == -1))
|
||||
__no = rand() % rv;
|
||||
multimap<int, grp_stock>::iterator i = currgrp->second.find(__type);
|
||||
std::multimap<int, grp_stock>::iterator i = currgrp->second.find(__type);
|
||||
while(__no--) i++;
|
||||
__data = i->second.data.char_item;
|
||||
}
|
||||
@@ -203,7 +203,7 @@ int Grp::GetItm(int __type, int& __data, int __no) {
|
||||
if(rv) {
|
||||
if((__no >= rv) or (__no == -1))
|
||||
__no = rand() % rv;
|
||||
multimap<int, grp_stock>::iterator i = currgrp->second.find(__type);
|
||||
std::multimap<int, grp_stock>::iterator i = currgrp->second.find(__type);
|
||||
while(__no--) i++;
|
||||
__data = i->second.data.int_item;
|
||||
}
|
||||
@@ -215,7 +215,7 @@ int Grp::GetItm(int __type, int& __data, int __no) {
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
int Grp::GetItm(int __type, string& __data, int __no) {
|
||||
int Grp::GetItm(int __type, std::string& __data, int __no) {
|
||||
|
||||
// Return error if a current group is not set
|
||||
if(currgrpno == -1)
|
||||
@@ -227,7 +227,7 @@ int Grp::GetItm(int __type, string& __data, int __no) {
|
||||
if(rv) {
|
||||
if((__no >= rv) or (__no == -1))
|
||||
__no = rand() % rv;
|
||||
multimap<int, grp_stock>::iterator i = currgrp->second.find(__type);
|
||||
std::multimap<int, grp_stock>::iterator i = currgrp->second.find(__type);
|
||||
while(__no--) i++;
|
||||
__data = *(i->second.data.string_item);
|
||||
}
|
||||
@@ -251,7 +251,7 @@ int Grp::GetItm(int __type, void* __data, int __size, int __no) {
|
||||
if(rv) {
|
||||
if((__no >= rv) or (__no == -1))
|
||||
__no = rand() % rv;
|
||||
multimap<int, grp_stock>::iterator i = currgrp->second.find(__type);
|
||||
std::multimap<int, grp_stock>::iterator i = currgrp->second.find(__type);
|
||||
while(__no--) i++;
|
||||
void *data = i->second.data.object_item;
|
||||
int local_size = *((int *)data);
|
||||
|
@@ -132,19 +132,19 @@ private:
|
||||
bool bool_item;
|
||||
char char_item;
|
||||
int int_item;
|
||||
string *string_item;
|
||||
std::string *string_item;
|
||||
void *object_item;
|
||||
} data;
|
||||
|
||||
grp_stock(bool item) { type = TYPE_BOOL; data.bool_item = item; }
|
||||
grp_stock(char item) { type = TYPE_CHAR; data.char_item = item; }
|
||||
grp_stock(int item) { type = TYPE_INT; data.int_item = item; }
|
||||
grp_stock(const string& item) { type = TYPE_STRING; data.string_item = new string(item); throw_new(data.string_item); }
|
||||
grp_stock(const std::string& item) { type = TYPE_STRING; data.string_item = new std::string(item); throw_new(data.string_item); }
|
||||
grp_stock(void *item) { type = TYPE_OBJECT; data.object_item = item; }
|
||||
};
|
||||
|
||||
vector< pair<string, multimap<int, grp_stock> > > container;
|
||||
vector< pair<string, multimap<int, grp_stock> > >::iterator currgrp;
|
||||
std::vector< std::pair<std::string, std::multimap<int, grp_stock> > > container;
|
||||
std::vector< std::pair<std::string, std::multimap<int, grp_stock> > >::iterator currgrp;
|
||||
|
||||
public:
|
||||
|
||||
@@ -160,13 +160,13 @@ public:
|
||||
void AddItm(int __type, bool __data);
|
||||
void AddItm(int __type, char __data);
|
||||
void AddItm(int __type, int __data);
|
||||
void AddItm(int __type, const string& __data);
|
||||
void AddItm(int __type, const std::string& __data);
|
||||
void AddItm(int __type, void* __data, int __size);
|
||||
|
||||
int GetItm(int __type, bool& __data, int __no=-1);
|
||||
int GetItm(int __type, char& __data, int __no=-1);
|
||||
int GetItm(int __type, int& __data, int __no=-1);
|
||||
int GetItm(int __type, string& __data, int __no=-1);
|
||||
int GetItm(int __type, std::string& __data, int __no=-1);
|
||||
int GetItm(int __type, void* __data, int __size, int __no=-1);
|
||||
};
|
||||
|
||||
|
@@ -369,7 +369,7 @@ int wmove (int nsrow, int nscol);
|
||||
int wopen (int srow, int scol, int erow, int ecol, int btype, int battr, int wattr, int sbattr=-1, int loattr=-1);
|
||||
inline int wopen_ (int srow, int scol, int vlen, int hlen, int btype, int battr, int wattr, int sbattr=-1, int loattr=-1) { return wopen(srow, scol, srow+vlen-1, scol+hlen-1, btype, battr, wattr, sbattr, loattr); }
|
||||
int wperror (const char* message);
|
||||
bool wpickfile (int srow, int scol, int erow, int ecol, int btype, int bordattr, int winattr, int barattr, bool title, string &filespec, VfvCP open, bool casesens=false);
|
||||
bool wpickfile (int srow, int scol, int erow, int ecol, int btype, int bordattr, int winattr, int barattr, bool title, std::string &filespec, VfvCP open, bool casesens=false);
|
||||
int wpickstr (int srow, int scol, int erow, int ecol, int btype, int bordattr, int winattr, int barattr, char* strarr[], int initelem, VfvCP open);
|
||||
int wprintc (int wrow, int wcol, int attr, vchar ch);
|
||||
int wprintf (const char* format, ...) __attribute__ ((format (printf, 1, 2)));
|
||||
|
@@ -198,7 +198,7 @@ public:
|
||||
void printc(int row, int col, int color, vchar ch);
|
||||
void prints(int row, int col, int color, const char* text);
|
||||
void printvs(int row, int col, int color, const vchar* text);
|
||||
void prints(int row, int col, int color, const string& text);
|
||||
void prints(int row, int col, int color, const std::string& text);
|
||||
void printns(int row, int col, int color, const char* text, int len, vchar fill=' ', int fill_color=-1);
|
||||
|
||||
int printf(const char* format, ...) __attribute__ ((format (printf, 2, 3)));
|
||||
@@ -562,7 +562,7 @@ inline void gwindow::printvs(int row, int col, int color, const vchar* text) {
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
inline void gwindow::prints(int row, int col, int color, const string& text) {
|
||||
inline void gwindow::prints(int row, int col, int color, const std::string& text) {
|
||||
|
||||
prints(row, col, color, text.c_str());
|
||||
}
|
||||
|
@@ -118,7 +118,7 @@ static void pre_exit(char** p, int numelems) {
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
bool wpickfile(int srow, int scol, int erow, int ecol, int btype, int bordattr, int winattr, int barattr, bool title, string &filespec, VfvCP open, bool casesens) {
|
||||
bool wpickfile(int srow, int scol, int erow, int ecol, int btype, int bordattr, int winattr, int barattr, bool title, std::string &filespec, VfvCP open, bool casesens) {
|
||||
|
||||
Path cwd, dir, namext, tcwd, path, spec;
|
||||
|
||||
|
@@ -59,7 +59,7 @@ public:
|
||||
int buf_pos;
|
||||
int buf_len;
|
||||
|
||||
string& destination;
|
||||
std::string& destination;
|
||||
|
||||
int id;
|
||||
int row;
|
||||
@@ -71,7 +71,7 @@ public:
|
||||
field* prev;
|
||||
field* next;
|
||||
|
||||
field(gwinput* iform, int idnum, int wrow, int wcol, int field_width, string& dest, int dest_size, int cvt, int mode);
|
||||
field(gwinput* iform, int idnum, int wrow, int wcol, int field_width, std::string& dest, int dest_size, int cvt, int mode);
|
||||
~field();
|
||||
|
||||
bool visible();
|
||||
@@ -148,7 +148,7 @@ public:
|
||||
|
||||
void setup(int i_attr, int a_attr, int e_attr, vchar fill, bool fill_acs);
|
||||
|
||||
void add_field(int idnum, int wrow, int wcol, int field_width, string& dest, int dest_size, int cvt=gwinput::cvt_none, int mode=gwinput::entry_conditional);
|
||||
void add_field(int idnum, int wrow, int wcol, int field_width, std::string& dest, int dest_size, int cvt=gwinput::cvt_none, int mode=gwinput::entry_conditional);
|
||||
|
||||
bool first(int id=0);
|
||||
bool next();
|
||||
|
@@ -101,7 +101,7 @@ void gwinput::after() {
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
void gwinput::add_field(int idnum, int wrow, int wcol, int field_width, string& dest, int dest_size, int cvt, int mode) {
|
||||
void gwinput::add_field(int idnum, int wrow, int wcol, int field_width, std::string& dest, int dest_size, int cvt, int mode) {
|
||||
|
||||
field* fld = new field(this, idnum, wrow, wcol, field_width, dest, dest_size, cvt, mode);
|
||||
throw_new(fld);
|
||||
@@ -618,7 +618,7 @@ bool gwinput::handle_key(gkey key) {
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
gwinput::field::field(gwinput* iform, int idnum, int wrow, int wcol, int field_width, string& dest, int dest_size, int cvt, int mode)
|
||||
gwinput::field::field(gwinput* iform, int idnum, int wrow, int wcol, int field_width, std::string& dest, int dest_size, int cvt, int mode)
|
||||
|
||||
: destination(dest)
|
||||
|
||||
|
Reference in New Issue
Block a user