Clean up libaegisub includes

Remove cajun includes from all public headers and the precompiled header

Add a pile of missing standard library headers used in multiple files
to lagi_pre

Originally committed to SVN as r5452.
This commit is contained in:
Thomas Goyne 2011-07-15 04:04:34 +00:00
parent 48fbedd25b
commit 6ec63cdde1
13 changed files with 34 additions and 40 deletions

View file

@ -19,10 +19,10 @@
/// @ingroup libaegisub /// @ingroup libaegisub
#ifndef LAGI_PRE #ifndef LAGI_PRE
#include <assert.h>
#include <errno.h> #include <errno.h>
#include <stdint.h> #include <stdint.h>
#include <cassert>
#include <map> #include <map>
#endif #endif

View file

@ -21,11 +21,11 @@
#ifndef LAGI_PRE #ifndef LAGI_PRE
#include <fstream> #include <fstream>
#include <time.h> #include <time.h>
#endif
#include "libaegisub/cajun/reader.h" #include "libaegisub/cajun/reader.h"
#include "libaegisub/cajun/writer.h" #include "libaegisub/cajun/writer.h"
#include "libaegisub/cajun/elements.h" #include "libaegisub/cajun/elements.h"
#endif
#include "libaegisub/access.h" #include "libaegisub/access.h"
#include "libaegisub/log.h" #include "libaegisub/log.h"

View file

@ -18,20 +18,23 @@
/// @brief Option interface. /// @brief Option interface.
/// @ingroup libaegisub /// @ingroup libaegisub
#include "libaegisub/option.h"
#ifndef LAGI_PRE #ifndef LAGI_PRE
#include <fstream> #include <fstream>
#include <sstream> #include <sstream>
#include <map> #include <map>
#include <memory> #include <memory>
#endif
#include "libaegisub/cajun/reader.h" #include "libaegisub/cajun/reader.h"
#include "libaegisub/cajun/writer.h" #include "libaegisub/cajun/writer.h"
#include "libaegisub/cajun/elements.h" #include "libaegisub/cajun/elements.h"
#endif
#include "libaegisub/access.h" #include "libaegisub/access.h"
#include "libaegisub/io.h" #include "libaegisub/io.h"
#include "libaegisub/log.h" #include "libaegisub/log.h"
#include "libaegisub/option_value.h"
#include "option_visit.h" #include "option_visit.h"

View file

@ -26,21 +26,18 @@
#endif #endif
#include <libaegisub/colour.h> #include <libaegisub/colour.h>
#include <libaegisub/option_value.h>
#include "option_visit.h" #include "option_visit.h"
namespace agi { namespace agi {
ConfigVisitor::ConfigVisitor(OptionValueMap &val, const std::string &member_name): values(val) { ConfigVisitor::ConfigVisitor(OptionValueMap &val, const std::string &member_name)
// Corresponding code is in AddOptionValue() : values(val)
name = member_name + "/"; , name(member_name + "/")
{
} }
ConfigVisitor::~ConfigVisitor() {
}
void ConfigVisitor::Visit(const json::Object& object) { void ConfigVisitor::Visit(const json::Object& object) {
json::Object::const_iterator index(object.Begin()), index_end(object.End()); json::Object::const_iterator index(object.Begin()), index_end(object.End());
for (; index != index_end; ++index) { for (; index != index_end; ++index) {

View file

@ -19,14 +19,9 @@
/// @see option_visit.cpp /// @see option_visit.cpp
/// @ingroup libaegisub /// @ingroup libaegisub
#ifndef LAGI_PRE #include "libaegisub/option.h"
#include "libaegisub/cajun/elements.h" #include "libaegisub/cajun/elements.h"
#include "libaegisub/cajun/visitor.h" #include "libaegisub/cajun/visitor.h"
#endif
#pragma once
#include "libaegisub/option.h"
namespace agi { namespace agi {
@ -36,7 +31,6 @@ DEFINE_SIMPLE_EXCEPTION_NOINNER(OptionJsonValueSingle, OptionJsonValueError, "op
DEFINE_SIMPLE_EXCEPTION_NOINNER(OptionJsonValueNull, OptionJsonValueError, "options/value") DEFINE_SIMPLE_EXCEPTION_NOINNER(OptionJsonValueNull, OptionJsonValueError, "options/value")
class ConfigVisitor : public json::ConstVisitor { class ConfigVisitor : public json::ConstVisitor {
OptionValueMap &values; OptionValueMap &values;
std::string name; std::string name;
typedef std::pair<std::string, OptionValue*> OptionValuePair; typedef std::pair<std::string, OptionValue*> OptionValuePair;
@ -44,9 +38,7 @@ class ConfigVisitor : public json::ConstVisitor {
void AddOptionValue(OptionValue* opt); void AddOptionValue(OptionValue* opt);
public: public:
ConfigVisitor(OptionValueMap &val, const std::string &member_name); ConfigVisitor(OptionValueMap &val, const std::string &member_name);
~ConfigVisitor();
void Visit(const json::Array& array); void Visit(const json::Array& array);
void Visit(const json::Object& object); void Visit(const json::Object& object);

View file

@ -26,6 +26,7 @@
#include "libaegisub/log.h" #include "libaegisub/log.h"
#include "libaegisub/path.h" #include "libaegisub/path.h"
#include "libaegisub/option.h" #include "libaegisub/option.h"
#include "libaegisub/option_value.h"
namespace agi { namespace agi {

View file

@ -26,8 +26,7 @@
#include <vector> #include <vector>
#endif #endif
#include <libaegisub/cajun/elements.h> namespace json { class Object; }
namespace agi { namespace agi {
namespace hotkey { namespace hotkey {
@ -125,7 +124,7 @@ private:
/// Build hotkey map. /// Build hotkey map.
/// @param context Context being parsed. /// @param context Context being parsed.
/// @param object json::Object holding items for context being parsed. /// @param object json::Object holding items for context being parsed.
void BuildHotkey(std::string context, const ::json::Object& object); void BuildHotkey(std::string context, const json::Object& object);
/// Insert Combo into HotkeyMap instance. /// Insert Combo into HotkeyMap instance.
/// @param combo Combo to insert. /// @param combo Combo to insert.

View file

@ -18,12 +18,11 @@
/// @brief Parse JSON files and return json::UnknownElement /// @brief Parse JSON files and return json::UnknownElement
/// @ingroup libaegisub io /// @ingroup libaegisub io
#include <libaegisub/cajun/reader.h> #include <libaegisub/cajun/reader.h>
#include <libaegisub/cajun/elements.h> #include <libaegisub/cajun/elements.h>
namespace agi { namespace agi {
namespace json_util { namespace json_util {
/// Parse a JSON stream. /// Parse a JSON stream.
/// @param stream JSON stream, this is deleted internally. /// @param stream JSON stream, this is deleted internally.

View file

@ -18,13 +18,13 @@
/// @brief Public interface for option values. /// @brief Public interface for option values.
/// @ingroup libaegisub /// @ingroup libaegisub
#pragma once
#ifndef LAGI_PRE #ifndef LAGI_PRE
#include <fstream> #include <fstream>
#endif #endif
#include <libaegisub/exception.h> #include <libaegisub/exception.h>
#include <libaegisub/option_value.h>
namespace json { namespace json {
class Object; class Object;
@ -37,6 +37,7 @@ DEFINE_BASE_EXCEPTION_NOINNER(OptionError,Exception)
DEFINE_SIMPLE_EXCEPTION_NOINNER(OptionErrorNotFound, OptionError, "options/not_found") DEFINE_SIMPLE_EXCEPTION_NOINNER(OptionErrorNotFound, OptionError, "options/not_found")
DEFINE_SIMPLE_EXCEPTION_NOINNER(OptionErrorDuplicateKey, OptionError, "options/dump/duplicate") DEFINE_SIMPLE_EXCEPTION_NOINNER(OptionErrorDuplicateKey, OptionError, "options/dump/duplicate")
class OptionValue;
/// This is a cool trick: make a class un-copyable, in this case we always want /// This is a cool trick: make a class un-copyable, in this case we always want
/// to update our *original* map, this will ensure that it is always updated in /// to update our *original* map, this will ensure that it is always updated in

View file

@ -3,12 +3,13 @@
#include "config.h" #include "config.h"
// Common C // Common C
#include <errno.h> #include <cassert>
#include <math.h> #include <cerrno>
#include <stdarg.h> #include <cmath>
#include <stdio.h> #include <cstdarg>
#include <cstdio>
#include <cstring>
#include <stdint.h> #include <stdint.h>
#include <string.h>
#include <sys/stat.h> #include <sys/stat.h>
#ifdef HAVE_SYS_TIME_H #ifdef HAVE_SYS_TIME_H
# include <sys/time.h> # include <sys/time.h>
@ -30,16 +31,21 @@
#endif #endif
// Common C++ // Common C++
#include <algorithm>
#include <deque> #include <deque>
#include <climits> #include <climits>
#include <fstream> #include <fstream>
#include <functional>
#include <iostream> #include <iostream>
#include <iterator> #include <iterator>
#include <list>
#include <locale> #include <locale>
#include <numeric> #include <numeric>
#include <map> #include <map>
#include <numeric>
#include <sstream> #include <sstream>
#include <string> #include <string>
#include <vector>
#ifdef _WIN32 #ifdef _WIN32
#include <functional> #include <functional>
@ -56,10 +62,3 @@
#else #else
# include <strstream> # include <strstream>
#endif #endif
// Cajun
#include "libaegisub/cajun/elements.h"
#include "libaegisub/cajun/reader.h"
#include "libaegisub/cajun/visitor.h"
#include "libaegisub/cajun/writer.h"

View file

@ -24,9 +24,10 @@
#include <wx/menu.h> #include <wx/menu.h>
#endif #endif
#include <libaegisub/cajun/elements.h>
#include <libaegisub/exception.h> #include <libaegisub/exception.h>
namespace json { class Array; }
namespace menu { namespace menu {
DEFINE_BASE_EXCEPTION_NOINNER(MenuError, agi::Exception) DEFINE_BASE_EXCEPTION_NOINNER(MenuError, agi::Exception)
DEFINE_SIMPLE_EXCEPTION_NOINNER(MenuJsonValueArray, MenuError, "menu/value/array") DEFINE_SIMPLE_EXCEPTION_NOINNER(MenuJsonValueArray, MenuError, "menu/value/array")

View file

@ -24,9 +24,10 @@
#include <wx/toolbar.h> #include <wx/toolbar.h>
#endif #endif
#include <libaegisub/cajun/elements.h>
#include <libaegisub/exception.h> #include <libaegisub/exception.h>
namespace json { class Array; }
namespace toolbar { namespace toolbar {
DEFINE_BASE_EXCEPTION_NOINNER(ToolbarError, agi::Exception) DEFINE_BASE_EXCEPTION_NOINNER(ToolbarError, agi::Exception)
DEFINE_SIMPLE_EXCEPTION_NOINNER(ToolbarJsonValueArray, ToolbarError, "toolbar/value/array") DEFINE_SIMPLE_EXCEPTION_NOINNER(ToolbarJsonValueArray, ToolbarError, "toolbar/value/array")

View file

@ -46,6 +46,7 @@
#include "aegisublocale.h" #include "aegisublocale.h"
#include <libaegisub/mru.h> #include <libaegisub/mru.h>
#include <libaegisub/option.h> #include <libaegisub/option.h>
#include <libaegisub/option_value.h>
#include <libaegisub/path.h> #include <libaegisub/path.h>
////////////// //////////////