Wtx ~ Wt Extension Library
WtxLib
ClientFolder.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 COSMETIC SUPPLY) ~ C006585
37  ** ADVANCE (ADVANCE PROTOTYPES INC) ~ C006767
38  ** ALB (ALFRED LARGE BOATS) ~ C000005
39  ** ALF (AMWARE COMPANY INC) ~ C002885
40  ** DATA (DATA TRANSFER CABLE INC) ~ C002247
41  ** DEIPLAN (DEIPLAN-TRAVELOCO) ~ C005227
42  ** DEKA (DEKA LIBRARY CO) ~ C001319
43  ** DSI (DSI INDIRECT) ~ C006488
44  ** DYNE (DYNE ROUNDABOUT) ~ C006166
45  ** DYNE IND (DYNE INDISCRETE) ~ C005418
46  ** SOLO (SOLO SINGERS) ~ C002094
47  ** SOP (SOPLANTING INC) ~ C000030
48  ** STAY (STAY AWAY 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 COSMETIC SUPPLY) ~ C006585
67  ** approot/customer/A/ADVANCE (ADVANCE PROTOTYPES INC) ~ C006767
68  ** approot/customer/A/ALB (ALFRED LARGE BOATS) ~ C000005
69  ** approot/customer/A/ALF (AMWARE COMPANY INC) ~ C002885
70  ** approot/customer/D/DATA (DATA TRANSFER CABLE INC) ~ C002247
71  ** approot/customer/D/DEIROSSI (DEIPLAN-TRAVELOCO) ~ C005227
72  ** approot/customer/D/DEKA (DEKA LIBRARY CO) ~ C001319
73  ** approot/customer/D/DSI (DSI INDIRECT) ~ C006488
74  ** approot/customer/D/DYNE (DYNE ROUNDABOUT) ~ C006166
75  ** approot/customer/D/DYNE IND (DYNE INDISCRETE) ~ C005418
76  ** approot/customer/S/SOLO (SOLO SINGERS) ~ C002094
77  ** approot/customer/S/SOP (SOPLANTING INC) ~ C000030
78  ** approot/customer/S/STAY (STAY AWAY 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 /*
98 ** \image html WtxClientFolderSample.png
99 */
100 
229 : public Wt::WObject
230 {
231  public:
232 
233  ClientFolder();
234 
236  (
237  int uid,
238  const std::string & key,
239  const std::string & name
240  );
241 
243  (
244  const std::string & uid,
245  const std::string & key,
246  const std::string & name
247  );
248 
249  ClientFolder( const ClientFolder & copy );
250 
307  static void setup
308  (
309 
320  const std::string & rootPath,
321 
336  const std::string & idPrefix,
337 
345  int idLength,
346 
352  char idPadding,
353 
360  const std::string & idSuffix
361 
362  ); // endstatic void setup
363 
372  static std::string & rootPath();
373 
380  static std::string & idPrefix();
381 
389  static int idLength();
390 
397  static std::string & idSuffix();
398 
406  static char idPadding();
407 
415  bool isValid() const;
416 
424  const std::string & uid() const;
425 
432  const std::string & key() const;
433 
440  const std::string & name() const;
441 
452  std::string fileParent( const std::string & subFolder = "" ) const;
453 
461  std::string filePath( const std::string & subFolder = "" ) const;
462 
471  std::string fileFolder( const std::string & subFolder = "" ) const;
472 
482  std::string fileAbsolutePath( const std::string & subFolder = "" ) const;
483 
490  std::string fileId() const;
491 
499  std::string fileCode() const;
500 
507  std::string fileName() const;
508 
515  std::string fileKey() const;
516 
523  std::string fileChar() const;
524 
532  std::string fileRoot( const std::string & subFolder = "" ) const;
533 
541  static std::string folder( const std::string & base, const std::string & sub );
542 
543  private:
544 
545  static std::string s_rootPath;
546  static std::string s_idPrefix;
547  static int s_idLength;
548  static char s_idPadding;
549  static std::string s_idSuffix;
550 
551  bool m_isValid;
552  std::string m_uid;
553  std::string m_key;
554  std::string m_name;
555 
556 }; // endclass ClientFolder
557 
558 } // endnamespace Wtx
559 
560 #endif // #ifndef __WTX_CLIENTFOLDER_H___
561 
562 
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.
Client Folder.
Definition: ClientFolder.h:228
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.