ReactOS 0.4.16-dev-334-g4d9f67c
config.cpp
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS HTTP Daemon
4 * FILE: config.cpp
5 * PURPOSE: Daemon configuration
6 * PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
7 * REVISIONS:
8 * CSH 01/09/2000 Created
9 */
10#include <new>
11#include <stdlib.h>
12#include <string.h>
13#include <config.h>
14#include <tchar.h>
15
16using namespace std;
17
20
21// Default constructor
23{
24 Reset();
25}
26
27// Default destructor
29{
30 Clear();
31}
32
33// Clear configuration
35{
36 MainBase = NULL;
37 HttpBase = NULL;
39}
40
41// Create default configuration. Can throw bad_alloc
43{
44 Clear();
47
48 LPSTR lpsStr;
49 try {
52 } catch (bad_alloc&) {
53 free((void *)lpsStr);
54 Clear();
55 throw;
56 }
57
59}
60
61// Clear configuration
63{
64 if (MainBase != NULL)
65 free((void *)MainBase);
66 if (HttpBase != NULL)
67 free((void *)HttpBase);
68
69 // Free memory for all strings
71 for (i->First(); !i->IsDone(); i->Next())
72 free((void *)i->CurrentItem());
73 delete i;
74
75 Reset();
76}
77
78// Load configuration
80{
81 Default();
82 return TRUE;
83}
84
85// Save configuration
87{
88 return TRUE;
89}
90
91// Return MainBase
93{
94 return MainBase;
95}
96
97// Set MainBase
98void CConfig::SetMainBase(LPWSTR lpwsMainBase)
99{
100 MainBase = lpwsMainBase;
101}
102
103// Return HttpBase
105{
106 return HttpBase;
107}
108
109// Set HttpBase
111{
112 HttpBase = lpsHttpBase;
113}
114
115// Return DefaultResources
117{
118 return &DefaultResources;
119}
120
121// Return bound port
123{
124 return Port;
125}
126
127// Set port
129{
130 Port = wPort;
131}
Definition: config.h:22
VOID SetMainBase(LPWSTR lpwsMainBase)
Definition: config.cpp:98
VOID Clear()
Definition: config.cpp:62
LPSTR HttpBase
Definition: config.h:40
VOID SetHttpBase(LPSTR lpsHttpBase)
Definition: config.cpp:110
BOOL Save()
Definition: config.cpp:86
LPSTR GetHttpBase()
Definition: config.cpp:104
VOID Default()
Definition: config.cpp:42
VOID SetPort(USHORT wPort)
Definition: config.cpp:128
LPWSTR GetMainBase()
Definition: config.cpp:92
VOID Reset()
Definition: config.cpp:34
LPWSTR MainBase
Definition: config.h:39
CList< LPSTR > DefaultResources
Definition: config.h:41
USHORT Port
Definition: config.h:42
~CConfig()
Definition: config.cpp:28
BOOL Load()
Definition: config.cpp:79
CConfig()
Definition: config.cpp:22
USHORT GetPort()
Definition: config.cpp:122
CList< LPSTR > * GetDefaultResources()
Definition: config.cpp:116
Definition: list.h:34
VOID Insert(Item &element)
Definition: list.h:123
CIterator< Item > * CreateIterator() const
Definition: list.h:93
VOID RemoveAll()
Definition: list.h:150
LPCConfig pConfiguration
Definition: config.cpp:18
LPCHttpDaemonThread pDaemonThread
Definition: config.cpp:19
#define free
Definition: debug_ros.c:5
#define _strdup
Definition: debug_ros.c:7
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
unsigned int BOOL
Definition: ntddk_ex.h:94
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define dcfgDefaultPort
Definition: config.h:20
#define dcfgMainBase
Definition: config.h:17
#define dcfgDefaultResource
Definition: config.h:19
#define dcfgHttpBase
Definition: config.h:18
Definition: features.h:417
unsigned short USHORT
Definition: pedump.c:61
_Check_return_ _CRTIMP wchar_t *__cdecl _wcsdup(_In_z_ const wchar_t *_Str)
char * LPSTR
Definition: xmlstorage.h:182
WCHAR * LPWSTR
Definition: xmlstorage.h:184