blob: a9fde8875df14ce3cbb8c92767f38b61c1dde397 [file] [log] [blame]
Václav Kubernát94938b72018-05-04 15:12:24 +02001/*
2 * Copyright (C) 2018 CESNET, https://photonics.cesnet.cz/
3 * Copyright (C) 2018 FIT CVUT, https://fit.cvut.cz/
4 *
5 * Written by Václav Kubernát <kubervac@fit.cvut.cz>
6 *
7*/
Václav Kubernát4108e0d2018-10-29 13:32:22 +01008/*! \file utils.hpp
9 \brief A header containing utility functions
10*/
Václav Kubernát94938b72018-05-04 15:12:24 +020011#include <string>
Václav Kubernátebca2552018-06-08 19:06:02 +020012#include "ast_path.hpp"
Václav Kubernát0b0272f2018-06-13 14:13:08 +020013#include "schema.hpp"
Václav Kubernát94938b72018-05-04 15:12:24 +020014
15std::string joinPaths(const std::string& prefix, const std::string& suffix);
Václav Kubernát60d6f292018-05-25 09:45:32 +020016std::string stripLastNodeFromPath(const std::string& path);
Václav Kubernát2eaceb82018-10-08 19:56:30 +020017schemaPath_ pathWithoutLastNode(const schemaPath_& path);
18dataPath_ pathWithoutLastNode(const dataPath_& path);
Václav Kubernát0b0272f2018-06-13 14:13:08 +020019std::string leafDataTypeToString(yang::LeafDataTypes type);
Václav Kubernát2eaceb82018-10-08 19:56:30 +020020std::string fullNodeName(const schemaPath_& location, const ModuleNodePair& pair);
21std::string fullNodeName(const dataPath_& location, const ModuleNodePair& pair);
Václav Kubernáta395d332019-02-13 16:49:20 +010022/** Returns a subset of the original set with only the strings starting with prefix */
23std::set<std::string> filterByPrefix(const std::set<std::string>& set, const std::string_view prefix);
Václav Kubernát9b725992019-05-29 16:39:47 +020024std::string leafDataToString(const leaf_data_ value);