Skip to content

Improve checking of Folder element in SyncFolderHierarchy #161

Open

Description

@idolum

Something like this:

    //! Utility function for finding the first node of
    //! a list of names.
    //! \param elem XML node the node should retrieved from
    //! \param node_names Names of requested nodes
    //! \returns Pointer to found XML node
    inline rapidxml::xml_node<>* find_first_node_of_ns(
        const rapidxml::xml_node<>& elem,
        const Ch* namespace,
        const std::vector<std::string>& node_names)
    {
        using namespace rapidxml;

        xml_node<>* result;

        for (auto name : node_names)
        {
            result = elem.first_node_ns(namespace, name);
            if (result)
            {
                return result;
            }
        }

        return result;
    }

Then it is possible to retrieve several node types:

std::vector<std::string> elem_list = { "Folder",
    "ContactsFolder", "SearchFolder", "TaskFolder" };
const auto folder_elem = item_elem.find_first_node_of_ns(
                    internal::uri<>::microsoft::types(), elem_list);
check(folder_elem,
   "Expected <Folder>, <ContactsFolder>, <SearchFolder> or <TaskFolder> element");

Originally posted by @idolum in #156 (comment)

Activity

  1. self-assigned this
    on Nov 21, 2019
  2. modified the milestones: 0.8, 0.9 on Nov 21, 2019
  3. modified the milestones: 0.9, 0.10 on Mar 15, 2021
  4. modified the milestones: 0.10, 0.11 on Jan 5, 2022
  5. modified the milestones: 0.11, 0.12 on Nov 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions