1 #ifndef BUILD_DEFAULTS_CLASS
2 #define BUILD_DEFAULTS_CLASS
4 /*****************************************************************************\
6 * Name : write_build_config *
7 * Author : Chris Koeritz *
11 * This class creates a header file that will provide macros that govern *
12 * how the build is created under win32 using visual studio project files. *
13 * This file is not on other platforms, nor with the clam makefile system. *
15 *******************************************************************************
16 * Copyright (c) 1995-$now By Author. This program is free software; you can *
17 * redistribute it and/or modify it under the terms of the GNU General Public *
18 * License as published by the Free Software Foundation; either version 2 of *
19 * the License or (at your option) any later version. This is online at: *
20 * http://www.fsf.org/copyleft/gpl.html *
21 * Please send any updates to: fred@gruntose.com *
22 \*****************************************************************************/
24 #include <application/application_shell.h>
25 #include <basis/astring.h>
26 #include <basis/enhance_cpp.h>
27 #include <basis/outcome.h>
28 #include <structures/set.h>
29 #include <structures/version_record.h>
31 class write_build_config : public application::application_shell
35 ~write_build_config();
37 DEFINE_CLASS_NAME("write_build_config");
40 //!< performs the main action of creating our build configuration header.
42 const structures::string_set &exclusions();
43 //!< returns the set of symbols that we will not include in the header.
45 basis::outcome output_macro(const basis::astring &symbol, const basis::astring &value,
46 basis::astring &accumulator);
47 //!< sends a macro definition for "symbol" with "value" to "accumulator".
49 basis::outcome output_decorated_macro(const basis::astring &symbol, const basis::astring &value,
50 basis::astring &cfg_accumulator, basis::astring &ver_accumulator);
51 //!< produces a new macro by adding a uniquifying string to "symbol".
52 /*!< if the item is a version component, it will be output to the
53 "ver_accumulator" but otherwise it goes to the "cfg_accumulator". */
55 basis::outcome output_definition_macro(const basis::astring &embedded_value,
56 basis::astring &accumulator);
57 //!< parses a 'name=value' pair out of "embedded_value" and writes a macro.
59 bool process_version_parts(const basis::astring &symbol, const basis::astring &value);
60 //!< checks on "symbol" to see if it's a version component. stores if so.
61 /*!< if the string was a version component, then true is returned. */
63 bool check_nesting(const basis::astring &to_check);
64 //!< if "to_check" is a make conditional, the nesting level is adjusted.
65 /*!< also if it's a conditional, true is returned, which means the line
68 bool write_output_file(const basis::astring &filename, const basis::astring &contents);
69 //!< writes "contents" to "filename" if it differs from current contents.
72 basis::astring *_end_matter; // stuff that isn't part of the real file.
73 structures::version *_ver; // accumulated when we see the right parts.
74 int _nesting; // how many levels of conditionals do we see?
77 write_build_config(const write_build_config &);
78 write_build_config &operator =(const write_build_config &);