public:
BinaryParser(Input &i, const std::string &s);
- virtual Statement parse();
- virtual void process_control_statement(const Statement &);
+ Statement parse() override;
+ void process_control_statement(const Statement &) override;
- virtual const StatementKey *peek(unsigned);
- virtual bool parse_and_load(unsigned, Loader &, const LoaderAction &);
+ const StatementKey *peek(unsigned) override;
+ bool parse_and_load(unsigned, Loader &, const LoaderAction &) override;
private:
IntType::Store parse_int();
public:
BinaryWriter(Output &o);
- virtual void set_float_precision(unsigned);
- virtual void write(const Statement &st);
+ void set_float_precision(unsigned) override;
+ void write(const Statement &st) override;
private:
void write_(const Statement &st);
void collect_keywords(const Statement &st);
void add_object(const std::string &, const char *, unsigned);
void add_object(const std::string &, const char *);
- virtual bool is_loadable(const CollectionItemTypeBase &, const std::string &) const;
- virtual NameList get_names(const CollectionItemTypeBase &) const;
- virtual void load(Collection &, const CollectionItemTypeBase &, const std::string &) const;
- virtual IO::Seekable *open(const std::string &) const;
+ bool is_loadable(const CollectionItemTypeBase &, const std::string &) const override;
+ NameList get_names(const CollectionItemTypeBase &) const override;
+ void load(Collection &, const CollectionItemTypeBase &, const std::string &) const override;
+ IO::Seekable *open(const std::string &) const override;
};
} // namespace DataFile
template<typename B>
struct Extractor: CollectionItemTypeBase::Extractor<B>
{
- virtual B &extract(const Variant &var) const
+ B &extract(const Variant &var) const override
{ return *var.value<RefPtr<T> >(); }
};
return *this;
}
- virtual bool is_same_type(const CollectionItemTypeBase &other) const
+ bool is_same_type(const CollectionItemTypeBase &other) const override
{ return dynamic_cast<const CollectionItemType<T> *>(&other); }
- virtual bool check_item_type(const Variant &var) const
+ bool check_item_type(const Variant &var) const override
{ return var.check_type<RefPtr<T> >(); }
- virtual void add_to_loader(Collection::Loader &) const
+ void add_to_loader(Collection::Loader &) const override
{ }
- virtual bool can_create() const
+ bool can_create() const override
{ return static_cast<bool>(create_func); }
- virtual void create_item(Collection &coll, const std::string &name) const
+ void create_item(Collection &coll, const std::string &name) const override
{
if(!create_func)
throw std::runtime_error("no creator");
coll.add(name, obj);
}
- virtual void load_item(Collection &, Parser &, const std::string &) const
+ void load_item(Collection &, Parser &, const std::string &) const override
{
throw std::runtime_error("this type cannot be loaded");
}
- virtual void notify_item(const std::string &name, const Variant &var) const
+ void notify_item(const std::string &name, const Variant &var) const override
{
RefPtr<T> obj = var.value<RefPtr<T> >();
for(const auto &n: notify_funcs)
class LoadableCollectionItemType: public CollectionItemType<T>
{
public:
- virtual void add_to_loader(Collection::Loader &loader) const
+ void add_to_loader(Collection::Loader &loader) const override
{ loader.add(this->kwd, &Collection::Loader::item<T, T>); }
- virtual void load_item(Collection &coll, Parser &parser, const std::string &name) const
+ void load_item(Collection &coll, Parser &parser, const std::string &name) const override
{
RefPtr<T> obj = new T;
Collection::ItemLoader<T> ldr(*obj, coll);
public:
void add_directory(const FS::Path &, bool = true);
- virtual bool is_loadable(const CollectionItemTypeBase &, const std::string &) const;
- virtual NameList get_names(const CollectionItemTypeBase &) const;
- virtual void load(Collection &, const CollectionItemTypeBase &, const std::string &) const;
- virtual IO::Seekable *open(const std::string &) const;
+ bool is_loadable(const CollectionItemTypeBase &, const std::string &) const override;
+ NameList get_names(const CollectionItemTypeBase &) const override;
+ void load(Collection &, const CollectionItemTypeBase &, const std::string &) const override;
+ IO::Seekable *open(const std::string &) const override;
bool lookup_file(const std::string &, FS::Path &) const;
};
~DynamicObjectLoader() { delete object; delete obj_loader; }
private:
- virtual void init_actions();
+ void init_actions() override;
public:
T *get_object() { T *o = object; object = 0; return o; }
data_error(const std::string &, unsigned, const std::string &);
data_error(const std::string &, unsigned, const std::exception &);
data_error(const std::string &, unsigned, const data_error &);
- virtual ~data_error() throw() = default;
+ ~data_error() throw() override = default;
const std::string &get_source() const { return source; }
unsigned get_line() const { return line; }
{
public:
parse_error(const std::string &);
- virtual ~parse_error() throw() = default;
+ ~parse_error() throw() override = default;
};
{
public:
syntax_error(const std::string &t);
- virtual ~syntax_error() throw() = default;
+ ~syntax_error() throw() override = default;
};
{
public:
bad_definition(const std::string &w);
- virtual ~bad_definition() throw() = default;
+ ~bad_definition() throw() override = default;
};
{
public:
nesting_error(const std::string &);
- virtual ~nesting_error() throw() = default;
+ ~nesting_error() throw() override = default;
};
{
public:
unknown_keyword(const std::string &);
- virtual ~unknown_keyword() throw() = default;
+ ~unknown_keyword() throw() override = default;
};
{
public:
invalid_signature(const std::string &, const std::string &);
- virtual ~invalid_signature() throw() = default;
+ ~invalid_signature() throw() override = default;
};
public:
JsonParser(Input &, const std::string &);
- virtual Statement parse();
+ Statement parse() override;
private:
Statement parse_statement(const Token *, State, const std::string &);
Token parse_token();
public:
LoaderFunc0(FuncType f): func(f) { }
- virtual void execute(Loader &l, const Statement &) const
+ void execute(Loader &l, const Statement &) const override
{
(dynamic_cast<L &>(l).*func)();
};
- virtual void execute(Loader &l, const ArgumentStore &) const
+ void execute(Loader &l, const ArgumentStore &) const override
{
(dynamic_cast<L &>(l).*func)();
};
- virtual std::string get_signature() const
+ std::string get_signature() const override
{ return std::string(); }
};
public:
LoaderFunc1(FuncType f): func(f) { }
- virtual void execute(Loader &l, const Statement &st) const
+ void execute(Loader &l, const Statement &st) const override
{
(dynamic_cast<L &>(l).*func)(st.args[0].get<A0>());
}
- virtual void execute(Loader &l, const ArgumentStore &as) const
+ void execute(Loader &l, const ArgumentStore &as) const override
{
(dynamic_cast<L &>(l).*func)(as.get<A0>(0));
}
- virtual std::string get_signature() const
+ std::string get_signature() const override
{ return std::string(1, TypeInfo<A0>::signature); }
};
public:
LoaderFunc1(FuncType f): func(f) { }
- virtual void execute(Loader &l, const Statement &st) const
+ void execute(Loader &l, const Statement &st) const override
{
std::vector<A0> values;
values.reserve(st.args.size());
(dynamic_cast<L &>(l).*func)(values);
}
- virtual void execute(Loader &l, const ArgumentStore &as) const
+ void execute(Loader &l, const ArgumentStore &as) const override
{
std::vector<A0> values;
unsigned n_args = as.get_info().key.signature.size();
(dynamic_cast<L &>(l).*func)(values);
}
- virtual std::string get_signature() const
+ std::string get_signature() const override
{
std::string result;
result += TypeInfo<A0>::signature;
public:
LoaderFunc1(FuncType f): func(f) { }
- virtual void execute(Loader &l, const Statement &st) const
+ void execute(Loader &l, const Statement &st) const override
{
(dynamic_cast<L &>(l).*func)(st);
}
- virtual void execute(Loader &, const ArgumentStore &) const
+ void execute(Loader &, const ArgumentStore &) const override
{
throw std::logic_error("incompatible format");
}
- virtual std::string get_signature() const
+ std::string get_signature() const override
{ return "*"; }
};
public:
LoaderFuncN(FuncType f): func(f) { }
- virtual void execute(Loader &l, const Statement &st) const
+ void execute(Loader &l, const Statement &st) const override
{
Apply<0, Args...>::apply(dynamic_cast<L &>(l), func, st);
}
- virtual void execute(Loader &l, const ArgumentStore &as) const
+ void execute(Loader &l, const ArgumentStore &as) const override
{
Apply<0, Args...>::apply(dynamic_cast<L &>(l), func, as);
}
- virtual std::string get_signature() const
+ std::string get_signature() const override
{ return create_signature<Args...>(); }
};
LoaderFuncNBound1(FuncType f, const B0 &b0): func(f), bound0(b0) { }
LoaderFuncNBound1(FuncType f, B0 &&b0): func(f), bound0(std::move(b0)) { }
- virtual void execute(Loader &l, const Statement &st) const
+ void execute(Loader &l, const Statement &st) const override
{
Apply<0, Args...>::apply(dynamic_cast<L &>(l), func, st, bound0);
}
- virtual void execute(Loader &l, const ArgumentStore &as) const
+ void execute(Loader &l, const ArgumentStore &as) const override
{
Apply<0, Args...>::apply(dynamic_cast<L &>(l), func, as, bound0);
}
- virtual std::string get_signature() const
+ std::string get_signature() const override
{ return create_signature<Args...>(); }
};
public:
LoadValue1(Pointer0Type p0): ptr0(p0) { }
- virtual void execute(Loader &l, const Statement &st) const
+ void execute(Loader &l, const Statement &st) const override
{
dynamic_cast<typename L::Loader &>(l).get_object().*ptr0 = st.args[0].get<T0>();
}
- virtual void execute(Loader &l, const ArgumentStore &as) const
+ void execute(Loader &l, const ArgumentStore &as) const override
{
dynamic_cast<typename L::Loader &>(l).get_object().*ptr0 = as.get<T0>(0);
}
- virtual std::string get_signature() const
+ std::string get_signature() const override
{ return std::string(1, TypeInfo<T0>::signature); }
};
public:
LoadValue1(Pointer0Type p0): ptr0(p0) { }
- virtual void execute(Loader &l, const Statement &st) const
+ void execute(Loader &l, const Statement &st) const override
{
typename L::Loader &ldr = dynamic_cast<typename L::Loader &>(l);
ldr.get_object().*ptr0 = &ldr.get_collection().template get<T0>(st.args[0].get<std::string>());
}
- virtual void execute(Loader &l, const ArgumentStore &as) const
+ void execute(Loader &l, const ArgumentStore &as) const override
{
typename L::Loader &ldr = dynamic_cast<typename L::Loader &>(l);
ldr.get_object().*ptr0 = &ldr.get_collection().template get<T0>(as.get<std::string>(0));
}
- virtual std::string get_signature() const
+ std::string get_signature() const override
{ return std::string(1, TypeInfo<std::string>::signature); }
};
public:
LoadValue2(Pointer0Type p0, Pointer1Type p1): ptr0(p0), ptr1(p1) { }
- virtual void execute(Loader &l, const Statement &st) const
+ void execute(Loader &l, const Statement &st) const override
{
dynamic_cast<typename L::Loader &>(l).get_object().*ptr0 = st.args[0].get<T0>();
dynamic_cast<typename L::Loader &>(l).get_object().*ptr1 = st.args[1].get<T1>();
}
- virtual void execute(Loader &l, const ArgumentStore &as) const
+ void execute(Loader &l, const ArgumentStore &as) const override
{
dynamic_cast<typename L::Loader &>(l).get_object().*ptr0 = as.get<T0>(0);
dynamic_cast<typename L::Loader &>(l).get_object().*ptr1 = as.get<T1>(1);
}
- virtual std::string get_signature() const
+ std::string get_signature() const override
{
std::string result;
result += TypeInfo<T0>::signature;
public:
Loader(File &);
private:
- virtual void finish();
+ void finish() override;
void object(const std::string &, const std::string &);
};
/// Returns information about the files in the pack.
std::list<FileInfo> list_files() const;
- virtual bool is_loadable(const CollectionItemTypeBase &, const std::string &) const;
- virtual NameList get_names(const CollectionItemTypeBase &) const;
- virtual void load(Collection &, const CollectionItemTypeBase &, const std::string &) const;
- virtual IO::Seekable *open(const std::string &) const;
+ bool is_loadable(const CollectionItemTypeBase &, const std::string &) const override;
+ NameList get_names(const CollectionItemTypeBase &) const override;
+ void load(Collection &, const CollectionItemTypeBase &, const std::string &) const override;
+ IO::Seekable *open(const std::string &) const override;
};
} // namespace DataFile
public:
TextParser(Input &, const std::string &);
- virtual Statement parse();
+ Statement parse() override;
protected:
Statement parse_statement(const Token *);
Token parse_token();
public:
TextWriter(Output &o);
- virtual void set_float_precision(unsigned);
- virtual void write(const Statement &st);
+ void set_float_precision(unsigned) override;
+ void write(const Statement &st) override;
private:
void write_(const Statement &st, unsigned);
};