Added a reference to the GPL
[gnucomo.git] / src / lib / gnucomo_config.cpp
1
2 /**************************************************************************
3 **  (c) Copyright 2002, Andromeda Technology & Automation
4 ** This is free software; you can redistribute it and/or modify it under the
5 ** terms of the GNU General Public License, see the file COPYING.
6 ***************************************************************************
7 ** MODULE INFORMATION *
8 ***********************
9 **      FILE NAME      : gnucomo_config.cpp
10 **      SYSTEM NAME    : Gnucomo - Gnu Computer Monitoring
11 **      VERSION NUMBER : $Revision: 1.3 $
12 **
13 **  DESCRIPTION      :  Implementation of the gnucomo_config class.
14 **
15 **  EXPORTED OBJECTS : 
16 **  LOCAL    OBJECTS : 
17 **  MODULES  USED    :
18 ***************************************************************************
19 **  ADMINISTRATIVE INFORMATION *
20 ********************************
21 **      ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl
22 **      CREATION DATE   : Jul 24, 2002
23 **      LAST UPDATE     : Nov 02, 2002
24 **      MODIFICATIONS   : 
25 **************************************************************************/
26
27 /*****************************
28    $Log: gnucomo_config.cpp,v $
29    Revision 1.3  2002-11-09 08:04:27  arjen
30    Added a reference to the GPL
31
32    Revision 1.2  2002/11/04 10:13:36  arjen
33    Use proper namespace for iostream classes
34
35    Revision 1.1  2002/10/05 10:25:49  arjen
36    Creation of gcm_input and a first approach to a web interface
37
38 *****************************/
39
40 static const char *RCSID = "$Id: gnucomo_config.cpp,v 1.3 2002-11-09 08:04:27 arjen Exp $";
41
42 #include "gnucomo_config.h"
43
44
45
46 /*=========================================================================
47 **  NAME           : Database
48 **  SYNOPSIS       : String gnucomo_config::Database()
49 **  PARAMETERS     : 
50 **  RETURN VALUE   : The database access string
51 **
52 **  DESCRIPTION    : 
53 **
54 **  VARS USED      :
55 **  VARS CHANGED   :
56 **  FUNCTIONS USED :
57 **  SEE ALSO       :
58 **  LAST MODIFIED  : Nov 02, 2002
59 **=========================================================================
60 */
61
62 String gnucomo_config::Database()
63 {
64    String param;
65    String access_string("");
66
67    param = find_parameter("database", "name");
68    if (param != "")
69    {
70       access_string += "dbname=" + param;
71    }
72
73    param = find_parameter("database", "user");
74    if (param != "")
75    {
76       access_string += " user=" + param;
77    }
78    param = find_parameter("database", "password");
79    if (param != "")
80    {
81       access_string += " password=" + param;
82    }
83
84    param = find_parameter("database", "host");
85    if (param != "")
86    {
87       access_string += " host=" + param;
88    }
89    param = find_parameter("database", "port");
90    if (param != "")
91    {
92       access_string += " port=" + param;
93    }
94    return access_string;
95 }