File: Configuration.h

package info (click to toggle)
postman 2.0-9
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 8,036 kB
  • ctags: 3,078
  • sloc: cpp: 31,131; ansic: 1,948; sh: 787; makefile: 285
file content (56 lines) | stat: -rw-r--r-- 1,462 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
Configuration.h
*/

#ifndef __CONFIGURATION_H
#define __CONFIGURATION_H

#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <signal.h>

#include "Utils.h"
#include "Config.h"
#include "XString.h"
#include "XVector.h"

typedef XVector<XString> StringList;

const int XXLINE_LEN_MAX = 300;
const int XXBUFFERSIZE   = XXLINE_LEN_MAX + 2;

class Configuration
  {
  private:
    XString fnconf;
    StringList SLFile;
    bool AbortInError;
    void Error (void);
  public:
    Configuration (const char *afnconf, bool aAbortInError);
    virtual ~Configuration (); 
    bool ConfRead (void);
    bool ConfSave (void);
    const char *getFileName (void);
    void setFileName (const char *afilename);
    bool newFile (const char *filecont);
    bool Reload (void);    
    bool Sync (void);
    void dumpDebug (void);
    char *getString (const char *asection, const char *akey, const char *adefault, int amaxsize);    
    bool setString (const char *asection, const char *akey, const char *astring, int amaxsize);
    int getInt (const char *asection, const char *akey, int adefault);
    bool setInt (const char *asection, const char *akey, int aint);
    bool IsThereSection (const char *asection);    
    bool getSection (const char *asection, StringList *ASection);
    int getFreeSlot (const char *slot, int CMAX);
    bool deleteSection (const char *asection);
  };
  
#endif