Codemesh Runtime v3 C++ API Reference
3.9.205
|
5 #ifndef XMOG_UTIL_FILE_INC
6 #define XMOG_UTIL_FILE_INC
16 # define XMOG_CASE_SENSITIVITY_DEFAULT false
18 # define XMOG_CASE_SENSITIVITY_DEFAULT true
45 bool matches(
const char * name,
bool bCaseSensitive = XMOG_CASE_SENSITIVITY_DEFAULT )
const;
58 static const char * noTerminators[];
63 file(
const char * name_ );
68 file(
const std::string & name_ );
74 file(
const file & parent_,
const char *
const name_ );
79 inline operator const std::string & ()
const
86 inline bool operator == (
const std::string & name )
const
92 inline const char *
name()
const
100 return mKeyName.c_str();
106 if( sub[ 0 ] ==
'\\' || sub[ 0 ] ==
'/' )
107 return file( (mName + sub).c_str() );
109 return file( (mName +
"/" + sub).c_str() );
122 return stats.st_size;
129 # if(XMOG_WINDOWS==1)
130 return exists() && ( stats.st_mode & _S_IFDIR ) != 0;
132 return exists() && ( stats.st_mode & S_IFDIR ) != 0;
139 # if(XMOG_WINDOWS==1)
140 return exists() && ( stats.st_mode & _S_IFREG ) != 0;
142 return exists() && ( stats.st_mode & S_IFREG ) != 0;
153 size_t list( ::std::vector<file> & container,
const char * filter = NULL, file_spec fs = fileAndDir,
bool bRecurse =
false,
const char * terms[] = noTerminators )
const;
160 std::string path(
const char * filter, file_spec fs = onlyFile )
const;
167 int read(
char ** pdata, jint * length );
172 int write(
const char * text );
176 int mkdir(
int mode = 0777 );
183 void init(
const char * name_ );
185 # if (XMOG_IS_MSVC==1)
186 # pragma warning( push )
187 # pragma warning( disable: 4251 )
190 ::std::string mKeyName;
191 # if (XMOG_IS_MSVC==1)
192 # pragma warning( pop )
202 #endif // XMOG_UTIL_FILE_INC
file nested(const char *sub) const
Return the file object representing a nested file, relative to this file.
Definition: xmog_util_file.h:104
Utility type for locating files based on a pattern.
Definition: xmog_util_file.h:39
bool exists() const
Return true if this instance represents an existing file.
Definition: xmog_util_file.h:114
bool is_file() const
Return true if this instance represents a regular file.
Definition: xmog_util_file.h:137
off_t size() const
Return the number of bytes in the file.
Definition: xmog_util_file.h:120
const char * key_name() const
Return the file's name.
Definition: xmog_util_file.h:98
const char * name() const
Return the file's name.
Definition: xmog_util_file.h:92
Utility wrapper for file objects.
Definition: xmog_util_file.h:54
bool is_dir() const
Return true if this instance represents a directory.
Definition: xmog_util_file.h:127
Copyright (c) 1999-2020 by Codemesh, Inc., ALL RIGHTS RESERVED.