29 #define access _access
50 if (path.length() == 0) {
53 while (path[path.length() - 1] ==
'/' || path[path.length() - 1] ==
'\\') {
54 path.erase(path.end() - 1);
56 if (path.length() == 0) {
59 return access(path.c_str(), R_OK) == 0;
68 const std::string::size_type beg = path.find_last_of(
"\\/");
69 if (beg == std::string::npos) {
72 return path.substr(0, beg + 1);
80 }
else if (extension.empty()) {
82 }
else if (path == extension) {
84 }
else if (path.size() < extension.size()) {
85 return path + extension;
88 std::string::const_reverse_iterator it_path = path.crbegin();
89 std::string::const_reverse_iterator it_extension = extension.crbegin();
91 while (it_extension != extension.crend()) {
93 if (*it_path != *it_extension) {
94 return path + extension;
108 return retPath + path;
114 const std::string::size_type colonPos = name.find(
":");
115 return (colonPos != std::string::npos) && (colonPos > 1);
125 if (path.length() > 0 && path[0] ==
'/') {
129 if (path.length() > 0 && path[0] ==
'\\') {
132 if (path.length() > 1 && path[1] ==
':') {
135 if (path ==
"nul" || path ==
"NUL") {
144 if (filename ==
"stdout" || filename ==
"STDOUT" || filename ==
"-") {
147 if (filename ==
"stderr" || filename ==
"STDERR") {
150 if (filename ==
"nul" || filename ==
"NUL") {
162 const std::string::size_type sep_index = path.find_last_of(
"\\/");
163 if (sep_index == std::string::npos) {
164 return prefix + path;
166 return path.substr(0, sep_index + 1) + prefix + path.substr(sep_index + 1);
176 strm.write((
char*) &value,
sizeof(
int));
183 strm.write((
char*) &value,
sizeof(
double));
190 strm.write((
char*) &value,
sizeof(
char));
197 int size = (int)value.length();
198 const char* cstr = value.c_str();
200 strm.write((
char*) cstr, (std::streamsize)(
sizeof(
char)*size));
207 strm.write((
char*) &value,
sizeof(
SUMOTime));