Wtx ~ Wt Extension Library
WtxLib
StaffFolder.h
1 
2  /*
3  ** \brief Client ID Part
4  **
5  ** This function constructs a string that appears as the id
6  ** element that contains the name we are looking for. The
7  ** id element is a value that begins with " ~ C" (for customer)
8  ** and then a leading-zero-padded numeric string. This is
9  ** usually enough to be able to track down a potentially
10  ** lost client folder in event that someone renamed it.
11  **
12  ** \par Examples include:
13  ** \code
14  ** " ~ C012320"
15  ** " ~ C045939"
16  ** " ~ C020034"
17  ** " ~ C200443"
18  ** " ~ C520344"
19  ** \v/v\--v-/
20  ** | | |
21  ** | | +---- clientId()
22  ** | +-------- clientIdPrefix()
23  ** +---------- separator
24  ** \endcode
25  **
26  */
27 
28  /*
29  ** \brief Client Folder Name
30  **
31  ** This function calculates what the client folder name
32  ** should be.
33  **
34  ** \par Examples include:
35  ** \code
36  ** AAA (AAA VACUUM) ~ C006585
37  ** ADVANCE (ADVANCE MFG INC) ~ C006767
38  ** ALB (ALBERT J ANGEL) ~ C000005
39  ** ALF (AMPAK COMPANY INC) ~ C002885
40  ** DATA (DATA OPTICS CABLE INC) ~ C002247
41  ** DEIROSSI (DEIROSSI-TRAVELOCITY) ~ C005227
42  ** DEKO (DEKO INTERNATIONAL CO) ~ C001319
43  ** DSI (DTI DIRECT) ~ C006488
44  ** DYNE (DYNE INDUSTRIES) ~ C006166
45  ** DYNE IND (DYNE INDUSTRIES) ~ C005418
46  ** SOLO (SOLO CUP) ~ C002094
47  ** SOP (SOPREMA INC) ~ C000030
48  ** STAY (STAY WELL INC) ~ C002876
49  ** \-v-/ \-----v-----/ \----v---/
50  ** | | |
51  ** | | +------------ clientIdPart()
52  ** | +-------------------------- name()
53  ** +------------------------------------ key()
54  ** \endcode
55  **
56  */
57 
58  /*
59  ** \brief Folder Path
60  **
61  ** The folder is more-or-less an absolute path
62  ** of the hard-drive.
63  **
64  ** \par Examples include:
65  ** \code
66  ** approot/customer/A/AAA (AAA VACUUM) ~ C006585
67  ** approot/customer/A/ADVANCE (ADVANCE MFG INC) ~ C006767
68  ** approot/customer/A/ALB (ALBERT J ANGEL) ~ C000005
69  ** approot/customer/A/ALF (AMPAK COMPANY INC) ~ C002885
70  ** approot/customer/D/DATA (DATA OPTICS CABLE INC) ~ C002247
71  ** approot/customer/D/DEIROSSI (DEIROSSI-TRAVELOCITY) ~ C005227
72  ** approot/customer/D/DEKO (DEKO INTERNATIONAL CO) ~ C001319
73  ** approot/customer/D/DSI (DTI DIRECT) ~ C006488
74  ** approot/customer/D/DYNE (DYNE INDUSTRIES) ~ C006166
75  ** approot/customer/D/DYNE IND (DYNE INDUSTRIES) ~ C005418
76  ** approot/customer/S/SOLO (SOLO CUP) ~ C002094
77  ** approot/customer/S/SOP (SOPREMA INC) ~ C000030
78  ** approot/customer/S/STAY (STAY WELL INC) ~ C002876
79  ** \-------v------/ v \-v-/ \-----v-----/ \----v---/
80  ** | | | | |
81  ** | | | | +------------ clientIdPart()
82  ** | | | +-------------------------- name()
83  ** | | +------------------------------------ key()
84  ** | +---------------------------------------- fileCode()
85  ** +------------------------------------------------- rootPath()
86  ** \endcode
87  **
88  */
89 
90 #ifndef __WTX_CLIENTFOLDER_H_234e0174_6b7d_11e8_b503_fb1ef3651ec0__
91 #define __WTX_CLIENTFOLDER_H_234e0174_6b7d_11e8_b503_fb1ef3651ec0__
92 
93 #include <string>
94 #include <vector>
95 
96 namespace Wtx {
97 
226 class ClientFolder
227 : public Wt::WObject
228 {
229  public:
230 
231  ClientFolder();
232 
233  ClientFolder
234  (
235  int uid,
236  const std::string & key,
237  const std::string & name
238  );
239 
240  ClientFolder
241  (
242  const std::string & uid,
243  const std::string & key,
244  const std::string & name
245  );
246 
247  ClientFolder( const ClientFolder & copy );
248 
305  static void setup
306  (
307 
318  const std::string & rootPath,
319 
334  const std::string & idPrefix,
335 
343  int idLength,
344 
350  char idPadding,
351 
358  const std::string & idSuffix
359 
360  ); // endstatic void setup
361 
370  static std::string & rootPath();
371 
378  static std::string & idPrefix();
379 
387  static int idLength();
388 
395  static std::string & idSuffix();
396 
404  static char idPadding();
405 
413  bool isValid() const;
414 
422  const std::string & uid() const;
423 
430  const std::string & key() const;
431 
438  const std::string & name() const;
439 
450  std::string fileParent( const std::string & subFolder = "" ) const;
451 
459  std::string filePath( const std::string & subFolder = "" ) const;
460 
469  std::string fileFolder( const std::string & subFolder = "" ) const;
470 
480  std::string fileAbsolutePath( const std::string & subFolder = "" ) const;
481 
488  std::string fileId() const;
489 
497  std::string fileCode() const;
498 
505  std::string fileName() const;
506 
513  std::string fileKey() const;
514 
521  std::string fileChar() const;
522 
530  std::string fileRoot( const std::string & subFolder = "" ) const;
531 
539  static std::string folder( const std::string & base, const std::string & sub );
540 
541  private:
542 
543  static std::string s_rootPath;
544  static std::string s_idPrefix;
545  static int s_idLength;
546  static char s_idPadding;
547  static std::string s_idSuffix;
548 
549  bool m_isValid;
550  std::string m_uid;
551  std::string m_key;
552  std::string m_name;
553 
554 }; // endclass ClientFolder
555 
556 } // endnamespace Wtx
557 
558 #endif // #ifndef __WTX_CLIENTFOLDER_H___
559 
560 
bool isValid() const
Is Valid.
std::string fileRoot(const std::string &subFolder="") const
File Root.
static char idPadding()
ID Padding.
std::string filePath(const std::string &subFolder="") const
File Path.
std::string fileFolder(const std::string &subFolder="") const
File Folder.
std::string fileAbsolutePath(const std::string &subFolder="") const
File Absolute Path.
std::string fileChar() const
File Character.
std::string fileId() const
Field ID.
static int idLength()
ID Length.
static std::string & rootPath()
Root Path.
const std::string & key() const
Key Value.
std::string fileName() const
File Name.
const std::string & name() const
Name Value.
std::string fileCode() const
File Code.
static std::string & idPrefix()
ID Prefix.
const std::string & uid() const
Unique ID.
static std::string & idSuffix()
ID Suffix.
witty extension library
Definition: Activity.h:51
static std::string folder(const std::string &base, const std::string &sub)
Folder.
std::string fileParent(const std::string &subFolder="") const
File Parent.
static void setup(const std::string &rootPath, const std::string &idPrefix, int idLength, char idPadding, const std::string &idSuffix)
Setup Global Static.
std::string fileKey() const
File Key.