File: gui2cpp.h

package info (click to toggle)
clanlib 0.8.1-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 28,372 kB
  • ctags: 16,520
  • sloc: cpp: 101,145; sh: 8,752; xml: 6,410; makefile: 1,740; ansic: 463; perl: 424; php: 247
file content (67 lines) | stat: -rw-r--r-- 1,880 bytes parent folder | download | duplicates (7)
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
57
58
59
60
61
62
63
64
65
66
67

#ifndef header_gui2cpp
#define header_gui2cpp

#include <ClanLib/core.h>
#include <ClanLib/display.h>
#include <ClanLib/gui.h>

class GUI2CPP
{
//! Construction:
public:
	GUI2CPP(const std::string &gui_file, const std::string &source_file, const std::string &header_file);

	~GUI2CPP();

//! Attributes:
public:

//! Operations:
public:
	//: Load GUI definition file, source file and header file.
	//- <p>Returns false if the loading of any of these files fail.</p>
	bool load();

	//: Convert the contents of source file and header file to include the GUI definition entries.
	bool convert();

	//: Save the source and header files.
	bool save();

//! Implementation:
private:
	bool parse_components(const CL_DomElement &componentsElement);

	//: Loads a file from disk.
	bool load_file(std::string &file_data, const std::string &filename);

	//: Saves a file to disk.
	bool save_file(const std::string &file_data, const std::string &filename);

	//: Returns an autogenerated code block.
	std::string find_block(const std::string &file_data, const std::string &block_name);

	//: Injects an autogenerated code block into a file data (source or header) string.
	bool inject_block(std::string &file_data, const std::string &block_name, const std::string &block_data);

	//: Filenames of the GUI definition file, the source file and the header file.
	std::string gui_file, source_file, header_file;

	//: Contents of the source and header files.
	std::string source_data, header_data;

	//: Generated header variables code block.
	std::string old_header_variables, new_header_variables;

	//: Generated header functions code block.
	std::string old_header_functions, new_header_functions;

	//: Generated soruce connections code block.
	std::string old_source_connections, new_source_connections;

	//: Contents of the GUI definition file.
	CL_DomDocument gui_document;
};

#endif