BinaryParser::BinaryParser(Input &i, const string &s):
ParserMode(i, s),
float_precision(32),
- cur_info(0)
+ cur_info(nullptr)
{
dict[-1] = StatementInfo("__kwd", "iss");
dict[-2] = StatementInfo("__str", "is");
if(cur_info)
{
key = &cur_info->key;
- cur_info = 0;
+ cur_info = nullptr;
}
else
{
for(unsigned i=sub_remaining.back(); i-->0; )
parse();
sub_remaining.pop_back();
- cur_info = 0;
+ cur_info = nullptr;
}
if(!sub_remaining.empty() && sub_remaining.back()==0)
{
// No more substatements on this level
- cur_info = 0;
- return 0;
+ cur_info = nullptr;
+ return nullptr;
}
if(cur_info)
int id = parse_int();
if(!in)
- return 0;
+ return nullptr;
cur_info = &get_item(dict, id);
return &cur_info->key;
if(!sub_remaining.empty())
--sub_remaining.back();
sub_remaining.push_back(parse_int());
- cur_info = 0;
+ cur_info = nullptr;
act.execute(ldr, args);
if(i!=objects.end())
return new IO::Memory(i->second.data, i->second.size);
- return 0;
+ return nullptr;
}
BuiltinSource::Object::Object():
- data(0),
+ data(nullptr),
size(0)
{ }
namespace DataFile {
Collection::Collection():
- fallback(0)
+ fallback(nullptr)
{ }
Collection::~Collection()
}
i = items.find(name);
- return (i!=items.end() ? &i->second : 0);
+ return (i!=items.end() ? &i->second : nullptr);
}
void Collection::gather_items(vector<const Variant *> *vars, list<string> *names, const CollectionItemTypeBase &type, bool include_sources) const
for(CollectionItemTypeBase *t: types)
if(t->is_same_type(type))
return t;
- return 0;
+ return nullptr;
}
CollectionItemTypeBase *Collection::get_type_for_item(const Variant &var) const
for(CollectionItemTypeBase *t: types)
if(t->check_item_type(var))
return t;
- return 0;
+ return nullptr;
}
void Collection::add_source(const CollectionSource &s)
if(IO::Seekable *io = s->open(name))
return io;
- return 0;
+ return nullptr;
}
void Collection::gather_names_from_sources(list<string> &names, const CollectionItemTypeBase &type) const
for(CollectionItemTypeBase *t: types)
if(dynamic_cast<CollectionItemType<T> *>(t))
return t;
- CollectionItemTypeBase *type = 0;
+ CollectionItemTypeBase *type = nullptr;
for(CollectionItemTypeBase *t: types)
if(t->can_extract<T>())
{
if(lookup_file(name, file))
return new IO::BufferedFile(file.str());
- return 0;
+ return nullptr;
}
bool DirectorySource::lookup_file(const string &name, FS::Path &result) const
template<typename T, typename C>
DynamicObjectLoader<T, C>::DynamicObjectLoader(Collection *c):
coll(c),
- object(0),
- obj_loader(0)
+ object(nullptr),
+ obj_loader(nullptr)
{
set_actions(shared_actions);
}
Input::Input(IO::Base &i):
in(&i),
- compressed(0),
+ compressed(nullptr),
line(1),
next(-1)
{ }
if(t)
{
token = *t;
- t = 0;
+ t = nullptr;
}
else
token = parse_token();
namespace DataFile {
Loader::Loader():
- actions(0),
- cur_st(0),
+ actions(nullptr),
+ cur_st(nullptr),
direct(false),
check_sub_loads(false)
{ }
LoaderAction *Loader::find_action(const StatementKey &key) const
{
if(!actions)
- return 0;
+ return nullptr;
auto begin = actions->lower_bound(StatementKey(key.keyword, string()));
auto end = actions->upper_bound(StatementKey(key.keyword, "~"));
if(begin==end)
throw unknown_keyword(key.keyword);
- LoaderAction *act = 0;
+ LoaderAction *act = nullptr;
int match = 0;
for(auto i=begin; i!=end; ++i)
{
/** Adds a keyword that is recognized but ignored. */
void add(const std::string &k)
- { add(k, 0); }
+ { add(k, nullptr); }
private:
void add(const std::string &, LoaderAction *);
Output::Output(IO::Base &o):
out(&o),
- compressed(0)
+ compressed(nullptr)
{ }
Output::~Output()
void PackSource::add_pack_file(const string &fn, const string &filter)
{
- add_pack(0, fn, filter);
+ add_pack(nullptr, fn, filter);
}
void PackSource::add_pack_io(IO::Seekable &io, const string &fn)
if(i!=files.end())
return i->second->open().release();
- return 0;
+ return nullptr;
}
return key;
}
- return 0;
+ return nullptr;
}
bool Parser::parse_and_load(unsigned level, Loader &ldr, const LoaderAction &act)
virtual Statement parse() = 0;
virtual void process_control_statement(const Statement &) { }
- virtual const StatementKey *peek(unsigned) { return 0; }
+ virtual const StatementKey *peek(unsigned) { return nullptr; }
virtual bool parse_and_load(unsigned, Loader &, const LoaderAction &) { return false; }
};
Statement TextParser::parse()
{
- return parse_statement(0);
+ return parse_statement(nullptr);
}
Statement TextParser::parse_statement(const Token *t)
if(t)
{
token = *t;
- t = 0;
+ t = nullptr;
}
else
token = parse_token();