File: SourcePythonParser.h

package info (click to toggle)
freeorion 0.5.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 194,940 kB
  • sloc: cpp: 186,508; python: 40,969; ansic: 1,164; xml: 719; makefile: 32; sh: 7
file content (28 lines) | stat: -rw-r--r-- 938 bytes parent folder | download
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
#ifndef _SourcePythonParser_h_
#define _SourcePythonParser_h_

#include "ValueRefPythonParser.h"

struct variable_wrapper {
    variable_wrapper(ValueRef::ReferenceType reference_type)
        : m_reference_type(reference_type)
    {}

    template<typename S>
    variable_wrapper(ValueRef::ReferenceType reference_type, S&& container)
        : m_reference_type(reference_type)
        , m_container(std::move(container))
    {}

    value_ref_wrapper<int> get_int_property(const char *property) const;
    value_ref_wrapper<double> get_double_property(const char *property) const;
    value_ref_wrapper<std::string> get_string_property(const char *property) const;
    variable_wrapper get_variable_property(const char *property) const;

    const ValueRef::ReferenceType m_reference_type;
    const std::vector<std::string> m_container;
};

void RegisterGlobalsSources(boost::python::dict& globals);

#endif // _SourcePythonParser_h_