Go to the documentation of this file.
4 #ifndef tools_wroot_directory
5 #define tools_wroot_directory
27 static uint32 class_version() {
return 1;}
30 static const std::string s_v(
"tools::wroot::directory");
51 mem::increment(
s_class().c_str());
54 directory(
ifile& a_file,
const std::string& a_name,
const std::string& a_title)
67 mem::increment(
s_class().c_str());
73 m_file.
out() <<
"tools::wroot::directory::directory :"
74 <<
" directory name cannot be \"\"."
78 if(
m_name.find(
'/')!=std::string::npos) {
79 m_file.
out() <<
"tools::wroot::directory::directory :"
81 <<
" cannot contain a slash."
90 const std::string& a_name,
91 const std::string& a_title)
104 mem::increment(
s_class().c_str());
110 m_file.
out() <<
"tools::wroot::directory::directory :"
111 <<
" directory name cannot be \"\"."
115 if(
m_name.find(
'/')!=std::string::npos) {
116 m_file.
out() <<
"tools::wroot::directory::directory :"
118 <<
" cannot contain a slash."
126 m_file.
out() <<
"tools::wroot::directory::directory :"
127 <<
" directory " <<
sout(
m_name) <<
" exists already."
140 m_file.
out() <<
"tools::wroot::directory::directory :"
149 m_file.
out() <<
"tools::wroot::directory::directory :"
151 <<
" cannot fill buffer."
159 m_file.
out() <<
"tools::wroot::directory::directory :"
160 <<
" key.write_self() failed."
166 m_file.
out() <<
"tools::wroot::directory::directory :"
168 <<
" cannot write key to file."
180 mem::decrement(
s_class().c_str());
190 mem::increment(
s_class().c_str());
205 m_file.
out() <<
"tools::wroot::directory::mkdir :"
206 <<
" directory name cannot be \"\"."
210 if(a_name.find(
'/')!=std::string::npos) {
211 m_file.
out() <<
"tools::wroot::directory::mkdir :"
212 <<
" " <<
sout(a_name)
213 <<
" cannot contain a slash."
219 m_file.
out() <<
"tools::wroot::directory::mkdir :"
220 <<
" directory badly created."
233 uint32 nbytes =
sizeof(short);
234 nbytes +=
sizeof(
date);
235 nbytes +=
sizeof(
date);
239 nbytes +=
sizeof(
seek);
240 nbytes +=
sizeof(
seek);
241 nbytes +=
sizeof(
seek);
246 if(!
save())
return false;
256 short version = class_version();
269 m_file.
out() <<
"tools::wroot::key::to_buffer :"
285 m_file.
out() <<
"tools::wroot::directory::write :"
297 if(!(*it)->write(n))
return false;
304 m_file.
out() <<
"tools::wroot::directory::write :"
306 <<
", write_object " <<
sout((*it)->name())
315 m_file.
out() <<
"tools::wroot::directory::write :"
317 <<
", save_self failed."
334 std::list<key*>::iterator it;
346 if(!(*it)->save())
return false;
368 m_file.
out() <<
"tools::wroot::directory::find_key :"
369 <<
" " <<
sout(a_name) <<
" ..."
373 if((*it)->object_name()==a_name)
return *it;
384 return ((*it)->cycle() + 1);
405 uint32 nbytes =
sizeof(nkeys);
408 nbytes += (*it)->key_length();
412 if(!headerkey.
seek_key())
return false;
416 if(!wb.
write(nkeys))
return false;
425 m_file.
out() <<
"tools::wroot::directory::write_keys :"
426 <<
" write header key"
439 m_file.
out() <<
"tools::wroot::directory::write_keys :"
440 <<
" key.write_self() failed."
452 char* header =
new char[nbytes];
482 m_file.
out() <<
"tools::wroot::directory::write_object :"
483 <<
" cannot stream object of store class name "
490 std::string name = a_obj.
name();
512 bool kdelete =
false;
516 if(kdelete)
delete [] kbuf;
526 m_file.
out() <<
"tools::wroot::directory::write_object :"
527 <<
" key.write_self() failed."
535 m_file.
out() <<
"tools::wroot::directory::_write_buffer :"
#define tools_lforcit(a__T, a__l, a__it)
#define tools_vforit(a__T, a__v, a__it)
#define tools_lforit(a__T, a__l, a__it)
#define tools_vforcit(a__T, a__v, a__it)