#define HOME_SIGNATURE "home:"
#define HOME_SIGNATURE_LEN 5
void
{
}
using namespace HDK_Sample;
#define FS_HOMEREADER_HANDLE_OPTIONS
#ifdef FS_HOMEREADER_HANDLE_OPTIONS
static inline bool
fsFindLastOption(
const char *option_name,
const UT_WorkArgs &options,
UT_String *option_value = NULL,
int *option_index = NULL)
{
option_tag = option_name;
option_tag += "=";
if( option_value )
if( option_index )
*option_index = -1;
for(
int i = options.
getArgc()-1; i >= 0; i-- )
{
if( token.startsWith( option_tag ))
{
if( option_value )
token.substr( *option_value, option_tag.
length() );
if( option_index )
*option_index = i;
return true;
}
}
return false;
}
static inline void
fsGetFileAndOptions(
const char *
source,
{
source_str.tokenize( list, '?' );
file_str.
harden( count > 0 ? list(0) :
"" );
options_str.
harden( count > 1 ? list(1) :
"" );
}
static inline void
{
bool do_questionmark = true;
bool do_ampersand = false;
for(
int i = 0; i < options.
getArgc(); i++ )
{
if( i == skip_index )
continue;
if( do_questionmark )
{
do_questionmark = false;
}
if( do_ampersand )
do_ampersand = true;
}
}
static inline bool
fsSplitPathIntoFileAndSection( const char *source,
{
int section_option_index;
fsGetFileAndOptions( source, file_str, options_str );
fsFindLastOption( "section", options, §ion_name, §ion_option_index);
fsAppendOptionsExceptForSkipped( buff, options, section_option_index );
}
static inline void
fsCombineFileAndSectionIntoPath(
UT_String &source,
const char *file_name, const char *section_name)
{
char separator;
separator = file_name_str.findChar('?') ? '&' : '?';
buffer.
append( section_name );
}
static inline void
{
while( fsSplitPathIntoFileAndSection( path, path, section_name ))
sections.
insert( section_name, 0 );
}
static inline void
{
for(
int i = 0; i < sections.
entries(); i++ )
sections(i) );
}
static inline void
const char *separator )
{
if( fsFindLastOption( option_name, options, &option_value ))
{
str += separator;
str += option_value;
}
}
static inline void
fsProcessNonSectionOptions(
UT_String &source )
{
fsGetFileAndOptions( source, source, options_str );
UT_ASSERT( ! fsFindLastOption(
"section", options ));
fsAppendFileSuffix( source, options, "version", "-" );
fsAppendFileSuffix( source, options, "ext", "." );
}
#endif // FS_HOMEREADER_HANDLE_OPTIONS
static inline void
{
}
static bool
fsConvertToStandardPathForWrite(
UT_String &destpath,
const char *srcpath)
{
return false;
destpath = srcpath;
#ifdef FS_HOMEREADER_HANDLE_OPTIONS
fsStripSectionOptions( destpath, sections );
fsProcessNonSectionOptions( destpath );
fsAppendSectionNames( destpath, sections );
#endif
fsPrefixPathWithHome(destpath);
return true;
}
static bool
fsConvertToStandardPathForRead(
UT_String &destpath,
const char *srcpath)
{
return false;
destpath = srcpath;
#ifdef FS_HOMEREADER_HANDLE_OPTIONS
fsProcessNonSectionOptions( destpath );
#endif
fsPrefixPathWithHome(destpath);
return true;
}
static bool
fsConvertToStandardPathForInfo(
UT_String &destpath,
const char *srcpath)
{
#ifdef FS_HOMEREADER_HANDLE_OPTIONS
#endif
return fsConvertToStandardPathForRead(destpath, srcpath);
}
{
}
{
}
{
if( fsConvertToStandardPathForRead(homepath, source) )
return is;
}
bool
{
#ifdef FS_HOMEREADER_HANDLE_OPTIONS
if( !source_section_path ||
return false;
fsSplitPathIntoFileAndSection( source_section_path,
index_file_path, section_name );
return true;
#else
return false;
#endif // FS_HOMEREADER_HANDLE_OPTIONS
}
bool
const char *index_file_path,
const char *section_name)
{
#ifdef FS_HOMEREADER_HANDLE_OPTIONS
return false;
fsCombineFileAndSectionIntoPath( source_section_path,
index_file_path, section_name );
return true;
#else
return false;
#endif // FS_HOMEREADER_HANDLE_OPTIONS
}
{
}
{
}
{
if( fsConvertToStandardPathForWrite(homepath, source) )
return os;
}
bool
{
}
bool
const char *source, mode_t
mode,
bool ignore_umask)
{
if (!fsConvertToStandardPathForWrite(homepath, source))
return false;
}
{
}
{
}
bool
{
}
bool
{
if( fsConvertToStandardPathForInfo(homepath, source) )
{
return info.hasAccess(mode);
}
return false;
}
bool
{
if( fsConvertToStandardPathForInfo(homepath, source) )
{
return info.getIsDirectory();
}
return false;
}
time_t
{
if( fsConvertToStandardPathForInfo(homepath, source) )
{
return info.getModTime();
}
return 0;
}
{
if( fsConvertToStandardPathForInfo(homepath, source) )
{
return info.getFileDataSize();
}
return 0;
}
{
if( fsConvertToStandardPathForInfo(homepath, source) )
{
#ifdef FS_HOMEREADER_HANDLE_OPTIONS
fsGetFileAndOptions( source, filename_str, options_str );
if( fsFindLastOption( "ext", options, &option_value ))
{
}
#endif
}
}
bool
{
if( fsConvertToStandardPathForInfo(homepath, source) )
{
return info.getContents(contents, dirs);
}
return false;
}