Add a function to the schema validator that I didn't end up needing
I've added it anyway because someone else extending the default validator could find it useful.
This commit is contained in:
parent
bc0419fc0a
commit
c765bac5d0
2 changed files with 14 additions and 0 deletions
|
@ -317,6 +317,19 @@ bool schema_validator::have_active_tag() const
|
|||
return !stack_.empty() && stack_.top();
|
||||
}
|
||||
|
||||
std::string schema_validator::active_tag_path() const {
|
||||
std::stack<const class_tag*> temp = stack_;
|
||||
std::deque<std::string> path;
|
||||
while(!temp.empty()) {
|
||||
path.push_front(temp.top()->get_name());
|
||||
temp.pop();
|
||||
}
|
||||
if(path.front() == "root") {
|
||||
path.pop_front();
|
||||
}
|
||||
return utils::join(path, "/");
|
||||
}
|
||||
|
||||
void schema_validator::print(message_info& el)
|
||||
{
|
||||
switch(el.type) {
|
||||
|
|
|
@ -140,6 +140,7 @@ private:
|
|||
protected:
|
||||
void queue_message(const config& cfg, message_type t, const std::string& file, int line = 0, int n = 0, const std::string& tag = "", const std::string& key = "", const std::string& value = "");
|
||||
const class_tag& active_tag() const;
|
||||
std::string active_tag_path() const;
|
||||
bool have_active_tag() const;
|
||||
bool is_valid() const {return config_read_;}
|
||||
class_type::ptr find_type(const std::string& type) const;
|
||||
|
|
Loading…
Add table
Reference in a new issue