feisty meow concerns codebase 2.140
configured_applications.h
Go to the documentation of this file.
1#ifndef CONFIGURED_APPLICATIONS_CLASS
2#define CONFIGURED_APPLICATIONS_CLASS
3
4/*****************************************************************************\
5* *
6* Name : configured_applications
7* Author : Chris Koeritz
8* *
9*******************************************************************************
10* Copyright (c) 2000 By Author. This program is free software; you can *
11* redistribute it and/or modify it under the terms of the GNU General Public *
12* License as published by the Free Software Foundation; either version 2 of *
13* the License or (at your option) any later version. This is online at: *
14* http://www.fsf.org/copyleft/gpl.html *
15* Please send any updates to: fred@gruntose.com *
16\*****************************************************************************/
17
18#include <basis/astring.h>
19#include <basis/contracts.h>
20#include <basis/mutex.h>
24
25namespace processes {
26
28
34{
35public:
36 configured_applications(const basis::astring &config_file, const basis::astring &basename);
38
43
44 // this section has mainly informational functions.
45
46 DEFINE_CLASS_NAME("configured_applications");
47
48 static const char *STARTUP_SECTION();
50
51 static const char *STARTUP_APP_NAME();
53
55 static bool find_entry(const structures::string_table &table, const basis::astring &name,
56 basis::astring &location);
58
62 const basis::astring &parms, bool one_shot);
64
65 static bool parse_startup_entry(const basis::astring &info, basis::astring &product,
66 basis::astring &parms, bool &one_shot);
68
72 bool product_exists(const basis::astring &product);
74
75 basis::astring find_program(const basis::astring &product, const basis::astring &app_name,
76 int &level);
78
82 // the following functions actually modify the configuration file.
83
84 bool find_section(const basis::astring &section_name, structures::string_table &info_found);
86
87 bool add_section(const basis::astring &section_name, const structures::string_table &info);
89
91 bool replace_section(const basis::astring &section_name, const structures::string_table &info);
93
95 bool add_program(const basis::astring &product, const basis::astring &app_name,
96 const basis::astring &full_path, int level);
98
102 bool remove_program(const basis::astring &product, const basis::astring &app_name);
104
105 bool add_startup_entry(const basis::astring &product, const basis::astring &app_name,
106 const basis::astring &parameters, int one_shot);
108
111 bool remove_startup_entry(const basis::astring &product, const basis::astring &app_name);
113
114private:
115 basis::mutex *_lock;
118};
119
120} //namespace.
121
122#endif
123
Provides a dynamically resizable ASCII character string.
Definition astring.h:35
Supports a configurator-based interface on text initialization files.
Tracks a collection of related configurations in a configurator.
Manages the initialization file for a set of registered applications.
bool replace_section(const basis::astring &section_name, const structures::string_table &info)
replaces the section for "section_name" with "info".
bool remove_startup_entry(const basis::astring &product, const basis::astring &app_name)
takes an existing entry for the "app_name" out of the startup section.
bool add_program(const basis::astring &product, const basis::astring &app_name, const basis::astring &full_path, int level)
registers a program "app_name" into the "product" section.
static const char * STARTUP_SECTION()
the section where startup info is stored.
bool add_startup_entry(const basis::astring &product, const basis::astring &app_name, const basis::astring &parameters, int one_shot)
establishes the "app_name" as a program launched at object startup.
static const char * STARTUP_APP_NAME()
a special placeholder name that will appear in the startup list.
bool add_section(const basis::astring &section_name, const structures::string_table &info)
puts a chunk of "info" into the section for "section_name".
static bool parse_startup_entry(const basis::astring &info, basis::astring &product, basis::astring &parms, bool &one_shot)
processes the items in "info" as an application startup list.
bool product_exists(const basis::astring &product)
returns true if the section for "product" exists in the TOC.
static basis::astring make_startup_entry(const basis::astring &product, const basis::astring &parms, bool one_shot)
returns the appropriate string for a startup record.
bool remove_program(const basis::astring &product, const basis::astring &app_name)
takes a previously registered "app_name" out of the list for "product".
basis::astring find_program(const basis::astring &product, const basis::astring &app_name, int &level)
seeks out the entry for the "product" and "app_name" in our info.
bool find_section(const basis::astring &section_name, structures::string_table &info_found)
locates the entries for "section_name" and stores them in "info_found".
DEFINE_CLASS_NAME("configured_applications")
static bool find_entry(const structures::string_table &table, const basis::astring &name, basis::astring &location)
returns true if the key "name" for a program is found in the "table".
Provides a symbol_table that holds strings as the content.