ders Namespace Reference


Classes

class  mem_buf
 Helper class for buf_cache to ensure exception safety. More...
class  buf_cache
 Keeps large buffers of requested size which are too expensive to allocate on demand. More...
class  readable
 Interface for readable classes. More...
class  writable
 Interface for writable classes. More...
class  buf_reader
 Provides buffered read functions for classes that implement readable interface. More...
class  buf_writer
 Provides buffered write functions for classes that implement writable interface. More...
class  cycl_buf
 Cyclic buffer. More...
class  data_in
 Interface for classes that can be read from. More...
class  data_out
 Interface for classes that can be written to. More...
class  data_io
 Interface for classes that support I/O operations defined by both data_in and data_out interfaces. More...
class  object_io
 Interface that is used by data_queue for object I/O. More...
class  data_queue
 Interface that defines interruptible data queue. More...
class  destroyable
 Interface for destroyable classes. More...
class  dir
 Interface that defines directory to find files in. More...
class  ErrorException
 Exception class with embed errorCode. More...
struct  FileLine
 Encapsulates file name and line number information. More...
class  Exception
 Base exception class with embed location, message and nested exception. More...
class  MsgException
 Abstract exception class for message exceptions that must pass exception handlers untouched. More...
class  ExitMsgException
 MsgException class with embed exitCode used to exit application with. More...
class  ExternException
 Abstract exception class for external exceptions with embed typeName. More...
class  StdExternException
 ExternException class for std::exception. More...
class  UnknExternException
 ExternException class for unknown exception. More...
class  file
 Provides file I/O operations. More...
class  FileErrorException
 ErrorException class with embed fileName. More...
class  fd
 Provides low level file I/O operations that don't depend on underlining implementation. More...
struct  key_hash
 Hash functor for hash_vec. More...
struct  ders::key_hash< char >
struct  ders::key_hash< unsigned char >
struct  ders::key_hash< signed char >
struct  ders::key_hash< short >
struct  ders::key_hash< unsigned short >
struct  ders::key_hash< int >
struct  ders::key_hash< unsigned int >
struct  ders::key_hash< long >
struct  ders::key_hash< unsigned long >
struct  ders::key_hash< T * >
struct  ders::key_hash< sh_text >
struct  key_eql
 Equal functor for hash_vec. More...
class  hash_vec
 Associative hash container. More...
class  mem_pool
 Non-synchronized memory pool to be used as thread-private object. More...
class  mp_newbuf
 Helper class for exception-safe memory allocation. More...
struct  path_elmt
 Path element for path processing functions. More...
class  sh_ptr
 Shared smart pointer that uses destroy() function to destruct passed objects. More...
class  stl_allocator
 STL-compatible allocator that uses mem_pool object for memory management. More...
class  task_opers
 Interface that defines available task operations. More...
class  task
 Interface for classes that can be executed by thread_pool. More...
struct  ch_rng
 Represents character range. More...
class  text
 Represents text or string as sequence of arbitrary characters. More...
class  text_buf
 Helper class for text concatenation and built-in types conversion. More...
class  thread
 Interface that defines implementation independent thread. More...
class  mutex
 Interface that defines implementation independent mutex. More...
class  auto_mutex
 Helper class for exception-safe mutex locking. More...
class  cond_var
 Interface that defines implementation independent condition variable. More...
class  barrier_listener
 Interface for classes that listen for on_release() barrier events. More...
class  barrier
 Represents implementation independent thread barrier. More...
class  thread_pool
 Interface that defines thread pool. More...
class  wldcrd_mtchr
 Represents implementation independent file name wildcard matcher. More...

Typedefs

typedef sh_ptr< cycl_bufsh_cycl_buf
typedef sh_ptr< data_iosh_data_io
typedef sh_ptr< data_queuesh_data_queue
typedef sh_ptr< dirsh_dir
typedef sh_ptr< ExceptionshException
typedef sh_ptr< filesh_file
typedef std::vector< data_queue * > dq_vec
typedef sh_ptr< textsh_text
typedef sh_ptr< threadsh_thread
typedef sh_ptr< mutexsh_mutex
typedef sh_ptr< cond_varsh_cond_var
typedef sh_ptr< barriersh_barrier
typedef sh_ptr< thread_poolsh_thread_pool
typedef sh_ptr< wldcrd_mtchrsh_wldcrd_mtchr

Enumerations

enum  error {
  ezero = 0, e2big = 1, eacces = 2, eaddrinuse = 3,
  eaddrnotavail = 4, eafnosupport = 5, eagain = 6, ealready = 7,
  ebadf = 8, ebadmsg = 9, ebusy = 10, ecanceled = 11,
  echild = 12, econnaborted = 13, econnrefused = 14, econnreset = 15,
  edeadlk = 16, edestaddrreq = 17, edom = 18, edquot = 19,
  eexist = 20, efault = 21, efbig = 22, ehostunreach = 23,
  eidrm = 24, eilseq = 25, einprogress = 26, eintr = 27,
  einval = 28, eio = 29, eisconn = 30, eisdir = 31,
  eloop = 32, emfile = 33, emlink = 34, emsgsize = 35,
  emultihop = 36, enametoolong = 37, enetdown = 38, enetreset = 39,
  enetunreach = 40, enfile = 41, enobufs = 42, enodata = 43,
  enodev = 44, enoent = 45, enoexec = 46, enolck = 47,
  enolink = 48, enomem = 49, enomsg = 50, enoprotoopt = 51,
  enospc = 52, enosr = 53, enostr = 54, enosys = 55,
  enotconn = 56, enotdir = 57, enotempty = 58, enotsock = 59,
  enotsup = 60, enotty = 61, enxio = 62, eopnotsupp = 63,
  eoverflow = 64, eperm = 65, epipe = 66, eproto = 67,
  eprotonosupport = 68, eprototype = 69, erange = 70, erofs = 71,
  espipe = 72, esrch = 73, estale = 74, etime = 75,
  etimedout = 76, etxtbsy = 77, eunkn = 78, ewouldblock = 79,
  exdev = 80
}
 Set of error codes that don't depend on underlining implementation. More...

Functions

sh_cycl_buf new_cycl_buf (mem_pool &mp, int rsrv)
 Creates new cycl_buf object.
sh_data_io new_data_io (sh_cycl_buf cb)
 Creates new data_io object.
sh_data_queue new_data_queue (mem_pool &mp, int rsrv=10 *1024)
 Creates new data_queue object.
sh_data_queue new_data_queue (sh_data_io dio)
 Creates new data_queue object.
template<class T>
void destroy (T *ptr, mem_pool &mp)
 Placement delete for mem_pool allocated objects.
sh_dir new_dir (mem_pool &mp, const ch_rng &dname)
 Creates new dir object.
error make_dir (mem_pool &mp, const ch_rng &dname)
error make_dirs (mem_pool &mp, const ch_rng &dname)
void ex_make_dir (mem_pool &mp, const ch_rng &dname)
void ex_make_dirs (mem_pool &mp, const ch_rng &dname)
sh_text error_message (mem_pool &mp, error err)
 Returns error message for passed error.
error convert_errno (int val)
 Converts implementation dependand errno value to error code.
shException newErrorException (mem_pool &mp, const FileLine &loc, const ch_rng &msg, error err)
shException newErrorException (const FileLine &loc, const ch_rng &msg, error err, shException nest)
sh_text toTextAll (const shException &she)
 Returns concatenated error message of all nested exceptions.
shException recatchException (mem_pool &mp, const FileLine &location)
 Converts current exception to shException object.
shException newException (mem_pool &mp, const FileLine &loc, const ch_rng &msg)
shException newException (const FileLine &loc, const ch_rng &msg, shException nest)
shException newExitMsgException (mem_pool &mp, const FileLine &loc, const ch_rng &msg, int ecode)
shException newExitMsgException (const FileLine &loc, const ch_rng &msg, int ecode, shException nest)
shException newStdExternException (mem_pool &mp, const FileLine &loc, const ch_rng &msg, const ch_rng &tname)
shException newStdExternException (const FileLine &loc, const ch_rng &msg, const ch_rng &tname, shException nest)
shException newUnknExternException (mem_pool &mp, const FileLine &loc, const ch_rng &msg)
shException newUnknExternException (const FileLine &loc, const ch_rng &msg, shException nest)
sh_file new_file (mem_pool &mp)
 Creates new file object.
sh_file new_file (mem_pool &mp, const ch_rng &path, file::mode md, int fls)
 Creates new file object.
sh_file new_file (mem_pool &mp, int fd)
 Creates new file object.
shException newFileErrorException (mem_pool &mp, const FileLine &loc, const ch_rng &msg, error err, const ch_rng &fname)
shException newFileErrorException (const FileLine &loc, const ch_rng &msg, error err, const ch_rng &fname, shException nest)
error remove (mem_pool &mp, const ch_rng &fname)
void ex_remove (mem_pool &mp, const ch_rng &fname)
void * mem_find (void *p1, int sz1, char ch)
const void * mem_find (const void *p1, int sz1, char ch)
void * mem_rev_find (void *p1, int sz1, char ch)
const void * mem_rev_find (const void *p1, int sz1, char ch)
void * mem_find (void *p1, int sz1, const void *p2, int sz2)
const void * mem_find (const void *p1, int sz1, const void *p2, int sz2)
void * mem_rev_find (void *p1, int sz1, const void *p2, int sz2)
const void * mem_rev_find (const void *p1, int sz1, const void *p2, int sz2)
void parse_path (mem_pool &mp, const ch_rng &path, std::vector< path_elmt > &ret)
 Splits path into path elements.
sh_text make_path (mem_pool &mp, const path_elmt *beg, const path_elmt *end, char spr=pathSepr)
 Creates path from path elements.
sh_text normalize_path (mem_pool &mp, const ch_rng &path)
 Normalizes path via applying parse_path() and make_path() functions.
sh_text get_path (mem_pool &mp, const ch_rng &path)
 Returns path part of the path.
sh_text get_name (mem_pool &mp, const ch_rng &path)
 Returns name part of the path.
template<class T, class U>
bool operator== (const stl_allocator< T > &at, const stl_allocator< U > &au)
template<class T, class U>
bool operator!= (const stl_allocator< T > &at, const stl_allocator< U > &au)
sh_text nt (mem_pool &mp)
sh_text nt (mem_pool &mp, const char *str)
sh_text nt (mem_pool &mp, const char *b, const char *e)
sh_text nt (mem_pool &mp, const ch_rng &r)
sh_text nt (mem_pool &mp, const text &t)
sh_text nt (mem_pool &mp, const sh_text &sht)
bool operator== (const ch_rng &r1, const ch_rng &r2)
bool operator!= (const ch_rng &r1, const ch_rng &r2)
bool operator< (const ch_rng &r1, const ch_rng &r2)
bool operator<= (const ch_rng &r1, const ch_rng &r2)
bool operator> (const ch_rng &r1, const ch_rng &r2)
bool operator>= (const ch_rng &r1, const ch_rng &r2)
sh_thread new_thread (mem_pool &mp, void(*start)(void *), void *arg)
 Creates new thread.
sh_mutex new_mutex (mem_pool &mp)
 Creates new mutex object for usual short term locking.
sh_mutex new_long_mutex (mem_pool &mp)
 Creates new mutex object for long term locking.
sh_cond_var new_cond_var (mem_pool &mp, mutex &mtx)
 Creates new cond_var object.
sh_barrier new_barrier (mem_pool &mp, int cnt)
 Creates new barrier object.
sh_thread_pool new_thread_pool (mem_pool &mp)
 Creates new singlethreaded thread_pool object.
sh_thread_pool new_thread_pool (mem_pool &mp, int cnt)
 Creates new multithreaded thread_pool object.
sh_wldcrd_mtchr new_wldcrd_mtchr (mem_pool &mp, const ch_rng &mask)
 Creates new wldcrd_mtchr object.

Variables

const char pathSepr = '/'
 Implementation-dependant path separator.


Typedef Documentation

typedef std::vector<data_queue*> ders::dq_vec

Definition at line 25 of file task.hpp.

Definition at line 149 of file thread.hpp.

Definition at line 101 of file thread.hpp.

Definition at line 49 of file cycl_buf.hpp.

Definition at line 96 of file data_io.hpp.

Definition at line 49 of file data_queue.hpp.

Definition at line 43 of file dir.hpp.

Definition at line 98 of file file.hpp.

Definition at line 58 of file thread.hpp.

Definition at line 27 of file text.hpp.

Definition at line 38 of file thread.hpp.

Definition at line 33 of file thread_pool.hpp.

Definition at line 64 of file wldcrd_mtchr.hpp.

Definition at line 35 of file exception.hpp.


Enumeration Type Documentation

Set of error codes that don't depend on underlining implementation.

Enumerator:
ezero 
e2big 
eacces 
eaddrinuse 
eaddrnotavail 
eafnosupport 
eagain 
ealready 
ebadf 
ebadmsg 
ebusy 
ecanceled 
echild 
econnaborted 
econnrefused 
econnreset 
edeadlk 
edestaddrreq 
edom 
edquot 
eexist 
efault 
efbig 
ehostunreach 
eidrm 
eilseq 
einprogress 
eintr 
einval 
eio 
eisconn 
eisdir 
eloop 
emfile 
emlink 
emsgsize 
emultihop 
enametoolong 
enetdown 
enetreset 
enetunreach 
enfile 
enobufs 
enodata 
enodev 
enoent 
enoexec 
enolck 
enolink 
enomem 
enomsg 
enoprotoopt 
enospc 
enosr 
enostr 
enosys 
enotconn 
enotdir 
enotempty 
enotsock 
enotsup 
enotty 
enxio 
eopnotsupp 
eoverflow 
eperm 
epipe 
eproto 
eprotonosupport 
eprototype 
erange 
erofs 
espipe 
esrch 
estale 
etime 
etimedout 
etxtbsy 
eunkn 
ewouldblock 
exdev 

Definition at line 28 of file error.hpp.

00028            {
00029   ezero=           0,  // No error
00030   e2big=           1,  // Argument list too long
00031   eacces=          2,  // Permission denied
00032   eaddrinuse=      3,  // Address in use
00033   eaddrnotavail=   4,  // Address not available
00034   eafnosupport=    5,  // Address family not supported
00035   eagain=          6,  // Resource unavailable, try again
00036   ealready=        7,  // Connection already in progress
00037   ebadf=           8,  // Bad file descriptor
00038   ebadmsg=         9,  // Bad message
00039   ebusy=          10,  // Device or resource busy
00040   ecanceled=      11,  // Operation canceled
00041   echild=         12,  // No child processes
00042   econnaborted=   13,  // Connection aborted
00043   econnrefused=   14,  // Connection refused
00044   econnreset=     15,  // Connection reset
00045   edeadlk=        16,  // Resource deadlock would occur
00046   edestaddrreq=   17,  // Destination address required
00047   edom=           18,  // Mathematics argument out of domain of function
00048   edquot=         19,  // Reserved (EDQUOT)
00049   eexist=         20,  // File exists
00050   efault=         21,  // Bad address
00051   efbig=          22,  // File too large
00052   ehostunreach=   23,  // Host is unreachable
00053   eidrm=          24,  // Identifier removed
00054   eilseq=         25,  // Illegal byte sequence
00055   einprogress=    26,  // Operation in progress
00056   eintr=          27,  // Interrupted function
00057   einval=         28,  // Invalid argument
00058   eio=            29,  // I/O error
00059   eisconn=        30,  // Socket is connected
00060   eisdir=         31,  // Is a directory
00061   eloop=          32,  // Too many levels of symbolic links
00062   emfile=         33,  // Too many open files
00063   emlink=         34,  // Too many links
00064   emsgsize=       35,  // Message too large
00065   emultihop=      36,  // Reserved (EMULTIHOP)
00066   enametoolong=   37,  // Filename too long
00067   enetdown=       38,  // Network is down
00068   enetreset=      39,  // Connection aborted by network
00069   enetunreach=    40,  // Network unreachable
00070   enfile=         41,  // Too many files open in system
00071   enobufs=        42,  // No buffer space available
00072   enodata=        43,  // No message is available on the STREAM head read queue
00073   enodev=         44,  // No such device
00074   enoent=         45,  // No such file or directory
00075   enoexec=        46,  // Executable file format error
00076   enolck=         47,  // No locks available
00077   enolink=        48,  // Reserved (ENOLINK)
00078   enomem=         49,  // Not enough space
00079   enomsg=         50,  // No message of the desired type
00080   enoprotoopt=    51,  // Protocol not available
00081   enospc=         52,  // No space left on device
00082   enosr=          53,  // No STREAM resources
00083   enostr=         54,  // Not a STREAM
00084   enosys=         55,  // Function not supported
00085   enotconn=       56,  // The socket is not connected
00086   enotdir=        57,  // Not a directory
00087   enotempty=      58,  // Directory not empty
00088   enotsock=       59,  // Not a socket
00089   enotsup=        60,  // Not supported
00090   enotty=         61,  // Inappropriate I/O control operation
00091   enxio=          62,  // No such device or address
00092   eopnotsupp=     63,  // Operation not supported on socket
00093   eoverflow=      64,  // Value too large to be stored in data type
00094   eperm=          65,  // Operation not permitted
00095   epipe=          66,  // Broken pipe
00096   eproto=         67,  // Protocol error
00097   eprotonosupport=68,  // Protocol not supported
00098   eprototype=     69,  // Protocol wrong type for socket
00099   erange=         70,  // Result too large
00100   erofs=          71,  // Read-only file system
00101   espipe=         72,  // Invalid seek
00102   esrch=          73,  // No such process
00103   estale=         74,  // Reserved (ESTALE)
00104   etime=          75,  // Stream ioctl() timeout
00105   etimedout=      76,  // Connection timed out
00106   etxtbsy=        77,  // Text file busy
00107   eunkn=          78,  // Unknown error
00108   ewouldblock=    79,  // Operation would block
00109   exdev=          80   // Cross-device link
00110 };


Function Documentation

error ders::convert_errno ( int  val  ) 

Converts implementation dependand errno value to error code.

Parameters:
val errno value.
Returns:
error code.

Definition at line 116 of file error.cpp.

00117 {
00118  switch (val) {
00119         case 0: return ezero;
00120 #ifdef E2BIG
00121         case E2BIG: return e2big;
00122 #endif
00123 #ifdef EACCES
00124         case EACCES: return eacces;
00125 #endif
00126 #ifdef EADDRINUSE
00127         case EADDRINUSE: return eaddrinuse;
00128 #endif
00129 #ifdef EADDRNOTAVAIL
00130         case EADDRNOTAVAIL: return eaddrnotavail;
00131 #endif
00132 #ifdef EAFNOSUPPORT
00133         case EAFNOSUPPORT: return eafnosupport;
00134 #endif
00135 #ifdef EAGAIN
00136         case EAGAIN: return eagain;
00137 #endif
00138 #ifdef EALREADY
00139         case EALREADY: return ealready;
00140 #endif
00141 #ifdef EBADF
00142         case EBADF: return ebadf;
00143 #endif
00144 #ifdef EBADMSG
00145         case EBADMSG: return ebadmsg;
00146 #endif
00147 #ifdef EBUSY
00148         case EBUSY: return ebusy;
00149 #endif
00150 #ifdef ECANCELED
00151         case ECANCELED: return ecanceled;
00152 #endif
00153 #ifdef ECHILD
00154         case ECHILD: return echild;
00155 #endif
00156 #ifdef ECONNABORTED
00157         case ECONNABORTED: return econnaborted;
00158 #endif
00159 #ifdef ECONNREFUSED
00160         case ECONNREFUSED: return econnrefused;
00161 #endif
00162 #ifdef ECONNRESET
00163         case ECONNRESET: return econnreset;
00164 #endif
00165 #ifdef EDEADLK
00166         case EDEADLK: return edeadlk;
00167 #endif
00168 #ifdef EDESTADDRREQ
00169         case EDESTADDRREQ: return edestaddrreq;
00170 #endif
00171 #ifdef EDOM
00172         case EDOM: return edom;
00173 #endif
00174 #ifdef EDQUOT
00175         case EDQUOT: return edquot;
00176 #endif
00177 #ifdef EEXIST
00178         case EEXIST: return eexist;
00179 #endif
00180 #ifdef EFAULT
00181         case EFAULT: return efault;
00182 #endif
00183 #ifdef EFBIG
00184         case EFBIG: return efbig;
00185 #endif
00186 #ifdef EHOSTUNREACH
00187         case EHOSTUNREACH: return ehostunreach;
00188 #endif
00189 #ifdef EIDRM
00190         case EIDRM: return eidrm;
00191 #endif
00192 #ifdef EILSEQ
00193         case EILSEQ: return eilseq;
00194 #endif
00195 #ifdef EINPROGRESS
00196         case EINPROGRESS: return einprogress;
00197 #endif
00198 #ifdef EINTR
00199         case EINTR: return eintr;
00200 #endif
00201 #ifdef EINVAL
00202         case EINVAL: return einval;
00203 #endif
00204 #ifdef EIO
00205         case EIO: return eio;
00206 #endif
00207 #ifdef EISCONN
00208         case EISCONN: return eisconn;
00209 #endif
00210 #ifdef EISDIR
00211         case EISDIR: return eisdir;
00212 #endif
00213 #ifdef ELOOP
00214         case ELOOP: return eloop;
00215 #endif
00216 #ifdef EMFILE
00217         case EMFILE: return emfile;
00218 #endif
00219 #ifdef EMLINK
00220         case EMLINK: return emlink;
00221 #endif
00222 #ifdef EMSGSIZE
00223         case EMSGSIZE: return emsgsize;
00224 #endif
00225 #ifdef EMULTIHOP
00226         case EMULTIHOP: return emultihop;
00227 #endif
00228 #ifdef ENAMETOOLONG
00229         case ENAMETOOLONG: return enametoolong;
00230 #endif
00231 #ifdef ENETDOWN
00232         case ENETDOWN: return enetdown;
00233 #endif
00234 #ifdef ENETRESET
00235         case ENETRESET: return enetreset;
00236 #endif
00237 #ifdef ENETUNREACH
00238         case ENETUNREACH: return enetunreach;
00239 #endif
00240 #ifdef ENFILE
00241         case ENFILE: return enfile;
00242 #endif
00243 #ifdef ENOBUFS
00244         case ENOBUFS: return enobufs;
00245 #endif
00246 #ifdef ENODATA
00247         case ENODATA: return enodata;
00248 #endif
00249 #ifdef ENODEV
00250         case ENODEV: return enodev;
00251 #endif
00252 #ifdef ENOENT
00253         case ENOENT: return enoent;
00254 #endif
00255 #ifdef ENOEXEC
00256         case ENOEXEC: return enoexec;
00257 #endif
00258 #ifdef ENOLCK
00259         case ENOLCK: return enolck;
00260 #endif
00261 #ifdef ENOLINK
00262         case ENOLINK: return enolink;
00263 #endif
00264 #ifdef ENOMEM
00265         case ENOMEM: return enomem;
00266 #endif
00267 #ifdef ENOMSG
00268         case ENOMSG: return enomsg;
00269 #endif
00270 #ifdef ENOPROTOOPT
00271         case ENOPROTOOPT: return enoprotoopt;
00272 #endif
00273 #ifdef ENOSPC
00274         case ENOSPC: return enospc;
00275 #endif
00276 #ifdef ENOSR
00277         case ENOSR: return enosr;
00278 #endif
00279 #ifdef ENOSTR
00280         case ENOSTR: return enostr;
00281 #endif
00282 #ifdef ENOSYS
00283         case ENOSYS: return enosys;
00284 #endif
00285 #ifdef ENOTCONN
00286         case ENOTCONN: return enotconn;
00287 #endif
00288 #ifdef ENOTDIR
00289         case ENOTDIR: return enotdir;
00290 #endif
00291 #ifdef ENOTEMPTY
00292         case ENOTEMPTY: return enotempty;
00293 #endif
00294 #ifdef ENOTSOCK
00295         case ENOTSOCK: return enotsock;
00296 #endif
00297 #if defined(ENOTSUP) && ENOTSUP!=EOPNOTSUPP
00298         case ENOTSUP: return enotsup;
00299 #endif
00300 #ifdef ENOTTY
00301         case ENOTTY: return enotty;
00302 #endif
00303 #ifdef ENXIO
00304         case ENXIO: return enxio;
00305 #endif
00306 #ifdef EOPNOTSUPP
00307         case EOPNOTSUPP: return eopnotsupp;
00308 #endif
00309 #ifdef EOVERFLOW
00310         case EOVERFLOW: return eoverflow;
00311 #endif
00312 #ifdef EPERM
00313         case EPERM: return eperm;
00314 #endif
00315 #ifdef EPIPE
00316         case EPIPE: return epipe;
00317 #endif
00318 #ifdef EPROTO
00319         case EPROTO: return eproto;
00320 #endif
00321 #ifdef EPROTONOSUPPORT
00322         case EPROTONOSUPPORT: return eprotonosupport;
00323 #endif
00324 #ifdef EPROTOTYPE
00325         case EPROTOTYPE: return eprototype;
00326 #endif
00327 #ifdef ERANGE
00328         case ERANGE: return erange;
00329 #endif
00330 #ifdef EROFS
00331         case EROFS: return erofs;
00332 #endif
00333 #ifdef ESPIPE
00334         case ESPIPE: return espipe;
00335 #endif
00336 #ifdef ESRCH
00337         case ESRCH: return esrch;
00338 #endif
00339 #ifdef ESTALE
00340         case ESTALE: return estale;
00341 #endif
00342 #ifdef ETIME
00343         case ETIME: return etime;
00344 #endif
00345 #ifdef ETIMEDOUT
00346         case ETIMEDOUT: return etimedout;
00347 #endif
00348 #ifdef ETXTBSY
00349         case ETXTBSY: return etxtbsy;
00350 #endif
00351 #if defined(EWOULDBLOCK) && EWOULDBLOCK!=EAGAIN
00352         case EWOULDBLOCK: return ewouldblock;
00353 #endif
00354 #ifdef EXDEV
00355         case EXDEV: return exdev;
00356 #endif
00357         default: return eunkn;
00358  }
00359 }

template<class T>
void ders::destroy ( T *  ptr,
mem_pool &  mp 
) [inline]

Placement delete for mem_pool allocated objects.

Destroys passed object depending on whether it implements destroyable interface or not.

Parameters:
ptr points to object to destroy. Can be NULL.
mp mem_pool to use.

Definition at line 79 of file destroy.hpp.

00080 { if (ptr) detail::destroy<T>(ptr, mp); }

sh_text ders::error_message ( mem_pool &  mp,
error  err 
)

Returns error message for passed error.

Parameters:
mp mem_pool to use.
err error code.
Returns:
error message.

Definition at line 110 of file error.cpp.

00111 {
00112  assert(unsigned(err)<sizeof(error_strs)/sizeof(*error_strs));
00113  return nt(mp, error_strs[err]);
00114 }

void ders::ex_make_dir ( mem_pool &  mp,
const ch_rng &  dname 
)

Definition at line 43 of file dir.cpp.

00044 {
00045  error err=make_dir(mp, dname);
00046  if (err!=ezero) {
00047     throw newFileErrorException(mp, _FLINE_, "Can't make directory", err,
00048       dname);
00049  }
00050 }

void ders::ex_make_dirs ( mem_pool &  mp,
const ch_rng &  dname 
)

Definition at line 52 of file dir.cpp.

00053 {
00054  error err=make_dirs(mp, dname);
00055  if (err!=ezero) {
00056     throw newFileErrorException(mp, _FLINE_, "Can't make directories", err,
00057       dname);
00058  }
00059 }

void ders::ex_remove ( mem_pool &  mp,
const ch_rng &  fname 
)

Definition at line 302 of file file.cpp.

00303 {
00304  error err=remove(mp, fname);
00305  if (err!=ezero)
00306     throw newFileErrorException(mp, _FLINE_, "Can't remove file", err, fname);
00307 }

sh_text ders::get_name ( mem_pool mp,
const ch_rng path 
)

Returns name part of the path.

Parameters:
mp mem_pool to use.
path path to parse.
Returns:
name part.

Definition at line 156 of file path.cpp.

00157 {
00158  std::vector<path_elmt> vpe;
00159  parse_path(mp, path, vpe);
00160 
00161  if (vpe.size() && vpe.back().tp==path_elmt::name) return nt(mp, vpe.back().nm);
00162  return nt(mp);
00163 }

sh_text ders::get_path ( mem_pool mp,
const ch_rng path 
)

Returns path part of the path.

Parameters:
mp mem_pool to use.
path path to parse.
Returns:
path part.

Definition at line 145 of file path.cpp.

00146 {
00147  std::vector<path_elmt> vpe;
00148  parse_path(mp, path, vpe);
00149 
00150  const path_elmt *beg=&*vpe.begin(), *end=&*vpe.end();
00151  if (end>beg && (end-1)->tp==path_elmt::name) end--;
00152 
00153  return make_path(mp, beg, end);
00154 }

error ders::make_dir ( mem_pool mp,
const ch_rng dname 
)

Definition at line 84 of file posix/dirimpl.cpp.

00085 {
00086  return (mkdir(text(mp, dname).c_str(), S_IRWXU|S_IRWXG|S_IRWXO)==-1) ?
00087    convert_errno(errno) : ezero;
00088 }

error ders::make_dirs ( mem_pool &  mp,
const ch_rng &  dname 
)

Definition at line 23 of file dir.cpp.

00024 {
00025  vector<path_elmt> vpe;
00026  parse_path(mp, dname, vpe);
00027 
00028  int i=0, end=vpe.size();
00029  for ( ; ; i++) {
00030      if (i>=end) return einval;
00031      if (vpe[i].tp==path_elmt::name) break;
00032  }
00033 
00034  error err;
00035  do {
00036     err=make_dir(mp, make_path(mp, &vpe[0], &vpe[0]+i+1));
00037     if (err!=ezero && err!=eexist) return err;
00038  } while (++i<end);
00039 
00040  return err;
00041 }

sh_text ders::make_path ( mem_pool mp,
const path_elmt beg,
const path_elmt end,
char  spr = pathSepr 
)

Creates path from path elements.

Parameters:
mp mem_pool to use.
beg points to first path element.
end points to past-the-end path element.
spr path separator to use.
Returns:
created path.

Definition at line 96 of file path.cpp.

00098 {
00099  sh_text ret(nt(mp));
00100  ret->reserve(512);
00101 
00102  for (const path_elmt* ptr=beg; ptr<end; ptr++) {
00103      switch (ptr->tp) {
00104             case path_elmt::drive: {
00105                  assert(ptr==beg);
00106 
00107                  ret->append(ptr->nm);
00108                  break;
00109             }
00110             case path_elmt::name: {
00111                  if (ptr>beg && (ptr[-1].tp==path_elmt::name ||
00112                      ptr[-1].tp==path_elmt::share))
00113                     ret->append(spr);
00114 
00115                  ret->append(ptr->nm);
00116                  break;
00117             }
00118             case path_elmt::root: {
00119                  assert(ptr==beg || ptr==beg+1&&beg->tp==path_elmt::drive);
00120                  assert(ptr->nm.size()==1);
00121 
00122                  ret->append(spr);
00123                  break;
00124             }
00125             case path_elmt::share: {
00126                  assert(ptr==beg);
00127 
00128                  ret->append(ptr->nm);
00129                  break;
00130             }
00131             default: assert(false);
00132      }
00133  }
00134 
00135  return ret;
00136 }

const void * ders::mem_find ( const void *  p1,
int  sz1,
const void *  p2,
int  sz2 
) [inline]

Definition at line 38 of file mem.hpp.

00039 { return mem_find(const_cast<void*>(p1), sz1, p2, sz2); }

void * ders::mem_find ( void *  p1,
int  sz1,
const void *  p2,
int  sz2 
)

Definition at line 54 of file mem.cpp.

00055 {
00056  if (sz1<=0 || sz2<=0) return 0;
00057 
00058  for (char *b=(char*)p1, *e=b+sz1-sz2+1; b<e; ) {
00059      char* ptr=(char*)mem_find(b, e-b, *(char*)p2);
00060      if (!ptr) return 0;
00061 
00062      if (memcmp(ptr+1, (char*)p2+1, sz2-1)==0) return ptr;
00063      b=ptr+1;
00064  }
00065 
00066  return 0;
00067 }

const void * ders::mem_find ( const void *  p1,
int  sz1,
char  ch 
) [inline]

Definition at line 32 of file mem.hpp.

00033 { return mem_find(const_cast<void*>(p1), sz1, ch); }

void * ders::mem_find ( void *  p1,
int  sz1,
char  ch 
)

Definition at line 20 of file mem.cpp.

00021 {
00022  return (sz1>0) ? memchr(p1, ch, sz1) : 0;
00023 }

const void * ders::mem_rev_find ( const void *  p1,
int  sz1,
const void *  p2,
int  sz2 
) [inline]

Definition at line 41 of file mem.hpp.

00043 { return mem_rev_find(const_cast<void*>(p1), sz1, p2, sz2); }

void * ders::mem_rev_find ( void *  p1,
int  sz1,
const void *  p2,
int  sz2 
)

Definition at line 69 of file mem.cpp.

00070 {
00071  if (sz1<=0 || sz2<=0) return 0;
00072 
00073  for (char *b=(char*)p1, *e=b+sz1-sz2+1; b<e; ) {
00074      char* ptr=(char*)mem_rev_find(b, e-b, *(char*)p2);
00075      if (!ptr) return 0;
00076 
00077      if (memcmp(ptr+1, (char*)p2+1, sz2-1)==0) return ptr;
00078      e=ptr;
00079  }
00080 
00081  return 0;
00082 }

const void * ders::mem_rev_find ( const void *  p1,
int  sz1,
char  ch 
) [inline]

Definition at line 35 of file mem.hpp.

00036 { return mem_rev_find(const_cast<void*>(p1), sz1, ch); }

void * ders::mem_rev_find ( void *  p1,
int  sz1,
char  ch 
)

Definition at line 25 of file mem.cpp.

00026 {
00027  char *e=(char*)p1+sz1-1, *b=e-sz1;
00028 
00029  for ( ; e>=b+4; e-=4) {
00030      if (*(e-0)==ch) return e-0;
00031      if (*(e-1)==ch) return e-1;
00032      if (*(e-2)==ch) return e-2;
00033      if (*(e-3)==ch) return e-3;
00034  }
00035 
00036  switch (e-b) {
00037         case 3:
00038              if (*(e-0)==ch) return e-0;
00039              if (*(e-1)==ch) return e-1;
00040              if (*(e-2)==ch) return e-2;
00041              break;
00042         case 2:
00043              if (*(e-0)==ch) return e-0;
00044              if (*(e-1)==ch) return e-1;
00045              break;
00046         case 1:
00047              if (*(e-0)==ch) return e-0;
00048              break;
00049  }
00050 
00051  return 0;
00052 }

sh_barrier ders::new_barrier ( mem_pool mp,
int  cnt 
)

Creates new barrier object.

Parameters:
mp mem_pool to use.
cnt initial threads count.
Returns:
created object.

Definition at line 191 of file mt_thread.cpp.

00192 {
00193  mp_newbuf<barrier> buf(mp);
00194  return sh_barrier(buf.pool(), buf.rls(::new(buf.get()) barrier(mp, cnt)));
00195 }

sh_cond_var ders::new_cond_var ( mem_pool mp,
mutex mtx 
)

Creates new cond_var object.

Parameters:
mp mem_pool to use.
mtx asociated mutex.
Returns:
created object.

Definition at line 202 of file posix/mt_threadimpl.cpp.

00203 {
00204  mp_newbuf<pos_cond_var> buf(mp);
00205  return sh_cond_var(buf.pool(), buf.rls(::new(buf.get()) pos_cond_var(mtx)));
00206 }

sh_cycl_buf ders::new_cycl_buf ( mem_pool &  mp,
int  rsrv 
)

Creates new cycl_buf object.

Parameters:
mp mem_pool to use.
rsrv initial buffer size.
Returns:
created object.

Definition at line 123 of file cycl_buf.cpp.

00124 {
00125  mp_newbuf<cycl_buf> buf(mp);
00126  return sh_cycl_buf(buf.pool(), buf.rls(::new(buf.get()) cycl_buf(rsrv)));
00127 }

sh_data_io ders::new_data_io ( sh_cycl_buf  cb  ) 

Creates new data_io object.

Parameters:
cb cycl_buf to use.
Returns:
created object.

Definition at line 259 of file data_io.cpp.

00260 {
00261  mp_newbuf<cb_dio> buf(cb.pool());
00262  return sh_data_io(buf.pool(), buf.rls(::new(buf.get()) cb_dio(cb)));
00263 }

sh_data_queue ders::new_data_queue ( sh_data_io  dio  ) 

Creates new data_queue object.

Parameters:
dio data_io to use.
Returns:
created object.

Definition at line 69 of file data_queue.cpp.

00070 {
00071  mp_newbuf<dq_impl> buf(dio.pool());
00072  return sh_data_queue(buf.pool(), buf.rls(::new(buf.get()) dq_impl(dio)));
00073 }

sh_data_queue ders::new_data_queue ( mem_pool mp,
int  rsrv = 10*1024 
)

Creates new data_queue object.

Parameters:
mp mem_pool to use.
rsrv initial queue buffer size.
Returns:
created object.

Definition at line 64 of file data_queue.cpp.

00065 {
00066  return new_data_queue(new_data_io(new_cycl_buf(mp, rsrv)));
00067 }

sh_dir ders::new_dir ( mem_pool mp,
const ch_rng dname 
)

Creates new dir object.

Parameters:
mp mem_pool to use.
dname directory name.
Returns:
created object.

Definition at line 78 of file posix/dirimpl.cpp.

00079 {
00080  mp_newbuf<pos_dir> buf(mp);
00081  return sh_dir(buf.pool(), buf.rls(::new(buf.get()) pos_dir(nt(mp, dname))));
00082 }

sh_file ders::new_file ( mem_pool &  mp,
int  fd 
)

Creates new file object.

Parameters:
mp mem_pool to use.
fd file descriptor to attach to.
Returns:
created object.

Definition at line 259 of file file.cpp.

00260 {
00261  mp_newbuf<file> buf(mp);
00262  return sh_file(buf.pool(), buf.rls(::new(buf.get()) file(buf.pool(), fd)));
00263 }

sh_file ders::new_file ( mem_pool &  mp,
const ch_rng &  path,
file::mode  md,
int  fls 
)

Creates new file object.

Parameters:
mp mem_pool to use.
path file path.
md open mode.
fls open flags.
Returns:
created object.

Definition at line 252 of file file.cpp.

00253 {
00254  mp_newbuf<file> buf(mp);
00255  return sh_file(buf.pool(), buf.rls(::new(buf.get()) file(buf.pool(), path, md,
00256    fls)));
00257 }

sh_file ders::new_file ( mem_pool &  mp  ) 

Creates new file object.

Parameters:
mp mem_pool to use.
Returns:
created object.

Definition at line 246 of file file.cpp.

00247 {
00248  mp_newbuf<file> buf(mp);
00249  return sh_file(buf.pool(), buf.rls(::new(buf.get()) file(buf.pool())));
00250 }

sh_mutex ders::new_long_mutex ( mem_pool mp  ) 

Creates new mutex object for long term locking.

Parameters:
mp mem_pool to use.
Returns:
created object.

Definition at line 69 of file mt_thread.cpp.

00070 {
00071  mp_newbuf<long_mutex> buf(mp);
00072  return sh_mutex(buf.pool(), buf.rls(::new(buf.get()) long_mutex(mp)));
00073 }

sh_mutex ders::new_mutex ( mem_pool mp  ) 

Creates new mutex object for usual short term locking.

Parameters:
mp mem_pool to use.
Returns:
created object.

Definition at line 196 of file posix/mt_threadimpl.cpp.

00197 {
00198  mp_newbuf<pos_mutex> buf(mp);
00199  return sh_mutex(buf.pool(), buf.rls(::new(buf.get()) pos_mutex));
00200 }

sh_thread ders::new_thread ( mem_pool mp,
void(*)(void *)  start,
void *  arg 
)

Creates new thread.

Parameters:
mp mem_pool to use.
start thread start function.
arg thread start function argument.
Returns:
created thread object.

Definition at line 185 of file posix/mt_threadimpl.cpp.

00186 {
00187  mp_newbuf<pos_thread> buf(mp);
00188  sh_thread ret(buf.pool(), buf.rls(::new(buf.get()) pos_thread(buf.pool(),
00189    start, arg)));
00190 
00191  static_cast<pos_thread*>(ret.get())->start();
00192 
00193  return ret;
00194 }

sh_thread_pool ders::new_thread_pool ( mem_pool mp,
int  cnt 
)

Creates new multithreaded thread_pool object.

Parameters:
mp mem_pool to use.
cnt threads count.
Returns:
created object.

Definition at line 220 of file mt_thread_pool.cpp.

00221 {
00222  mp_newbuf<mt_thrpl> buf(mp);
00223  return sh_thread_pool(buf.pool(), buf.rls(::new(buf.get()) mt_thrpl(cnt)));
00224 }

sh_thread_pool ders::new_thread_pool ( mem_pool mp  ) 

Creates new singlethreaded thread_pool object.

Parameters:
mp mem_pool to use.
Returns:
created object.

Definition at line 48 of file thread_pool.cpp.

00049 {
00050  mp_newbuf<st_thrpl> buf(mp);
00051  return sh_thread_pool(buf.pool(), buf.rls(::new(buf.get()) st_thrpl));
00052 }

sh_wldcrd_mtchr ders::new_wldcrd_mtchr ( mem_pool &  mp,
const ch_rng &  mask 
)

Creates new wldcrd_mtchr object.

Parameters:
mp mem_pool to use.
mask mask to match with.
Returns:
created object.

Definition at line 133 of file wldcrd_mtchr.cpp.

00134 {
00135  mp_newbuf<wldcrd_mtchr> buf(mp);
00136  return sh_wldcrd_mtchr(buf.pool(), buf.rls(::new(buf.get()) wldcrd_mtchr(mp,
00137    mask)));
00138 }

shException ders::newErrorException ( const FileLine &  loc,
const ch_rng &  msg,
error  err,
shException  nest 
)

Definition at line 367 of file error.cpp.

00369 {
00370  mp_newbuf<ErrorException> buf(nest.pool());
00371  return shException(buf.pool(), buf.rls(::new(buf.get()) ErrorException(loc,
00372    msg, err, nest)));
00373 }

shException ders::newErrorException ( mem_pool &  mp,
const FileLine &  loc,
const ch_rng &  msg,
error  err 
)

Definition at line 361 of file error.cpp.

00363 {
00364  return newErrorException(loc, msg, err, shException(mp, 0));
00365 }

shException ders::newException ( const FileLine &  loc,
const ch_rng &  msg,
shException  nest 
)

Definition at line 79 of file exception.cpp.

00081 {
00082  mp_newbuf<Exception> buf(nest.pool());
00083  return shException(buf.pool(), buf.rls(::new(buf.get()) Exception(loc, msg,
00084    nest)));
00085 }

shException ders::newException ( mem_pool &  mp,
const FileLine &  loc,
const ch_rng &  msg 
)

Definition at line 74 of file exception.cpp.

00075 {
00076  return newException(loc, msg, shException(mp, 0));
00077 }

shException ders::newExitMsgException ( const FileLine &  loc,
const ch_rng &  msg,
int  ecode,
shException  nest 
)

Definition at line 114 of file exception.cpp.

00116 {
00117  mp_newbuf<ExitMsgException> buf(nest.pool());
00118  return shException(buf.pool(), buf.rls(::new(buf.get()) ExitMsgException(loc,
00119    msg, ecode, nest)));
00120 }

shException ders::newExitMsgException ( mem_pool &  mp,
const FileLine &  loc,
const ch_rng &  msg,
int  ecode 
)

Definition at line 108 of file exception.cpp.

00110 {
00111  return newExitMsgException(loc, msg, ecode, shException(mp, 0));
00112 }

shException ders::newFileErrorException ( const FileLine &  loc,
const ch_rng &  msg,
error  err,
const ch_rng &  fname,
shException  nest 
)

Definition at line 271 of file file.cpp.

00273 {
00274  mp_newbuf<FileErrorException> buf(nest.pool());
00275  return shException(buf.pool(), buf.rls(::new(buf.get()) FileErrorException(loc,
00276    msg, err, fname, nest)));
00277 }

shException ders::newFileErrorException ( mem_pool &  mp,
const FileLine &  loc,
const ch_rng &  msg,
error  err,
const ch_rng &  fname 
)

Definition at line 265 of file file.cpp.

00267 {
00268  return newFileErrorException(loc, msg, err, fname, shException(mp, 0));
00269 }

shException ders::newStdExternException ( const FileLine &  loc,
const ch_rng &  msg,
const ch_rng &  tname,
shException  nest 
)

Definition at line 151 of file exception.cpp.

00153 {
00154  mp_newbuf<StdExternException> buf(nest.pool());
00155  return shException(buf.pool(), buf.rls(::new(buf.get()) StdExternException(loc,
00156    msg, tname, nest)));
00157 }

shException ders::newStdExternException ( mem_pool &  mp,
const FileLine &  loc,
const ch_rng &  msg,
const ch_rng &  tname 
)

Definition at line 145 of file exception.cpp.

00147 {
00148  return newStdExternException(loc, msg, tname, shException(mp, 0));
00149 }

shException ders::newUnknExternException ( const FileLine &  loc,
const ch_rng &  msg,
shException  nest 
)

Definition at line 176 of file exception.cpp.

00178 {
00179  mp_newbuf<UnknExternException> buf(nest.pool());
00180  return shException(buf.pool(), buf.rls(::new(buf.get()) UnknExternException(
00181    loc, msg, nest)));
00182 }

shException ders::newUnknExternException ( mem_pool &  mp,
const FileLine &  loc,
const ch_rng &  msg 
)

Definition at line 170 of file exception.cpp.

00172 {
00173  return newUnknExternException(loc, msg, shException(mp, 0));
00174 }

sh_text ders::normalize_path ( mem_pool mp,
const ch_rng path 
)

Normalizes path via applying parse_path() and make_path() functions.

Parameters:
mp mem_pool to use.
path path to normalize.
Returns:
normalized path.

Definition at line 138 of file path.cpp.

00139 {
00140  std::vector<path_elmt> vpe;
00141  parse_path(mp, path, vpe);
00142  return make_path(mp, &*vpe.begin(), &*vpe.end());
00143 }

sh_text ders::nt ( mem_pool &  mp,
const sh_text &  sht 
) [inline]

Definition at line 133 of file text.hpp.

00134 { return nt(mp, ch_rng(sht)); }

sh_text ders::nt ( mem_pool &  mp,
const text &  t 
) [inline]

Definition at line 130 of file text.hpp.

00131 { return nt(mp, ch_rng(t)); }

sh_text ders::nt ( mem_pool &  mp,
const ch_rng &  r 
)

Definition at line 35 of file text.cpp.

00036 {
00037  mp_newbuf<text> buf(mp);
00038  return sh_text(buf.pool(), buf.rls(::new(buf.get()) text(buf.pool(), r)));
00039 }

sh_text ders::nt ( mem_pool &  mp,
const char *  b,
const char *  e 
) [inline]

Definition at line 127 of file text.hpp.

00128 { return nt(mp, ch_rng(b, e)); }

sh_text ders::nt ( mem_pool &  mp,
const char *  str 
) [inline]

Definition at line 124 of file text.hpp.

00125 { return nt(mp, ch_rng(str)); }

sh_text ders::nt ( mem_pool &  mp  )  [inline]

Definition at line 121 of file text.hpp.

00122 { return nt(mp, ch_rng(0, 0)); }

bool ders::operator!= ( const ch_rng &  r1,
const ch_rng &  r2 
) [inline]

Definition at line 136 of file text.hpp.

00137 { return !(r1==r2); }

template<class T, class U>
bool ders::operator!= ( const stl_allocator< T > &  at,
const stl_allocator< U > &  au 
) [inline]

Definition at line 72 of file stl_alloc.hpp.

00073 { return !(at==au); }

bool ders::operator< ( const ch_rng &  r1,
const ch_rng &  r2 
) [inline]

Definition at line 139 of file text.hpp.

00140 { return detail::compare(r1, r2)<0; }

bool ders::operator<= ( const ch_rng &  r1,
const ch_rng &  r2 
) [inline]

Definition at line 142 of file text.hpp.

00143 { return detail::compare(r1, r2)<=0; }

bool ders::operator== ( const ch_rng &  r1,
const ch_rng &  r2 
)

Definition at line 41 of file text.cpp.

00042 {
00043  int sz1=r1.size(), sz2=r2.size();
00044  return sz1==sz2 && memcmp(r1.beg, r2.beg, sz1)==0;
00045 }

template<class T, class U>
bool ders::operator== ( const stl_allocator< T > &  at,
const stl_allocator< U > &  au 
) [inline]

Definition at line 68 of file stl_alloc.hpp.

00069 { return &at.pool()==&au.pool(); }

bool ders::operator> ( const ch_rng &  r1,
const ch_rng &  r2 
) [inline]

Definition at line 145 of file text.hpp.

00146 { return detail::compare(r1, r2)>0; }

bool ders::operator>= ( const ch_rng &  r1,
const ch_rng &  r2 
) [inline]

Definition at line 148 of file text.hpp.

00149 { return detail::compare(r1, r2)>=0; }

void ders::parse_path ( mem_pool mp,
const ch_rng path,
std::vector< path_elmt > &  ret 
)

Splits path into path elements.

Parameters:
mp mem_pool to use.
path path to parse.
[out] ret parsed path elements.

Definition at line 48 of file path.cpp.

00049 {
00050  ret.clear();
00051 
00052  const char* ptr=path.beg;
00053 
00054  if (path.end-ptr>=5) {  // "\\a\b"
00055     ch_rng spr=fsepr(ptr, path.end);
00056     if (spr.size()==2) {
00057        ch_rng srv=fname(spr.end, path.end);
00058        if (srv.size()>0) {
00059           ch_rng spr2=fsepr(srv.end, path.end);
00060           if (spr2.size()==1) {
00061              ch_rng shr=fname(spr2.end, path.end);
00062              if (shr.size()>0) {
00063                 ret.push_back(path_elmt(path_elmt::share, ch_rng(ptr,
00064                   shr.end)));
00065                 ptr=fsepr(shr.end, path.end).end;
00066              }
00067           }
00068        }
00069     }
00070  }
00071 
00072  if (path.end-ptr>=2) {  // "A:"
00073     ch_rng nm=fname(ptr, path.end);
00074     if (nm.size()>=2 && nm.beg[1]==':') {
00075        nm.end=nm.beg+2;
00076        ret.push_back(path_elmt(path_elmt::drive, nm));
00077        ptr=nm.end;
00078     }
00079  }
00080 
00081  ch_rng spr=fsepr(ptr, path.end);
00082  if (spr.size()>0) {  // "\"
00083     ret.push_back(path_elmt(path_elmt::root, ch_rng(ptr, ptr+1)));
00084     ptr=spr.end;
00085  }
00086 
00087  for (;;) {
00088      ch_rng nm=fname(ptr, path.end);
00089      if (nm.size()<=0) break;
00090 
00091      ret.push_back(path_elmt(path_elmt::name, nm));
00092      ptr=fsepr(nm.end, path.end).end;
00093  }
00094 }

shException ders::recatchException ( mem_pool &  mp,
const FileLine &  location 
)

Converts current exception to shException object.

Parameters:
mp mem_pool to use.
location location to use for non-shException exceptions.
Returns:
current or newly created exception object.

Definition at line 44 of file exception.cpp.

00045 {
00046  try { throw; }
00047  catch (shException she) {
00048        return she;
00049  }
00050  catch (const std::exception& se) {
00051        return newStdExternException(mp, location, se.what(), typeid(se).name());
00052  }
00053  catch (...) {
00054        return newUnknExternException(mp, location, "Unknown exception");
00055  }
00056 }

error ders::remove ( mem_pool &  mp,
const ch_rng &  fname 
)

Definition at line 297 of file file.cpp.

00298 {
00299  return (::remove(text(mp, fname).c_str())==-1) ? convert_errno(errno) : ezero;
00300 }

sh_text ders::toTextAll ( const shException &  she  ) 

Returns concatenated error message of all nested exceptions.

Parameters:
she exception object.
Returns:
error message.

Definition at line 26 of file exception.cpp.

00027 {
00028  mem_pool& mp(she.pool());
00029  if (!she.get()) return nt(mp);
00030 
00031  text_buf buf(mp);
00032  for (shException e=she; ; ) {
00033      buf+e->toText();
00034 
00035      e=e->nested;
00036      if (!e.get()) break;
00037 
00038      buf+'\n';
00039  }
00040 
00041  return buf;
00042 }


Variable Documentation

const char ders::pathSepr = '/'

Implementation-dependant path separator.

Definition at line 19 of file posix/pathimpl.cpp.


Generated on Tue Dec 8 11:35:32 2009 for derslib by  doxygen 1.5.5