Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve checking of Folder element in SyncFolderHierarchy #161

Open
idolum opened this issue Nov 21, 2019 · 0 comments
Open

Improve checking of Folder element in SyncFolderHierarchy #161

idolum opened this issue Nov 21, 2019 · 0 comments
Assignees
Milestone

Comments

@idolum
Copy link
Member

idolum commented Nov 21, 2019

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)

@idolum idolum self-assigned this Nov 21, 2019
@idolum idolum added this to the 0.8 milestone Nov 21, 2019
@idolum idolum modified the milestones: 0.8, 0.9 Nov 26, 2019
@idolum idolum modified the milestones: 0.9, 0.10 Mar 15, 2021
@idolum idolum modified the milestones: 0.10, 0.11 Jan 5, 2022
@idolum idolum modified the milestones: 0.11, 0.12 Nov 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant