Sha256: ba806f1488601462f61b5b43af0e67f66b56513399a7f4dce878f4beaf7b9b00

Contents?: true

Size: 1002 Bytes

Versions: 5

Compression:

Stored size: 1002 Bytes

Contents

//
//  refract/Registry.h
//  librefract
//
//  Created by Jiri Kratochvil on 21/05/15.
//  Copyright (c) 2015 Apiary Inc. All rights reserved.
//
#ifndef REFRACT_REGISTRY_H
#define REFRACT_REGISTRY_H

#include <map>
#include <string>

namespace refract
{

    // Forward declarations of IElement
    struct IElement;

    class Registry
    {
        // FIXME: potentionally dangerous,
        // if element is deleted and not removed from registry
        // solution: std::shared_ptr<> || std::weak_ptr<>
        typedef std::map<std::string, IElement*> Map;
        Map registrated;

        std::string getElementId(IElement* element);

    public:

        IElement* find(const std::string& name) const;

        bool add(IElement* element) ;
        bool remove(const std::string& name);
        void clearAll(bool releaseElements = false);
    };

    IElement* FindRootAncestor(const std::string& name, const Registry& registry);

}; // namespace refract

#endif // #ifndef REFRACT_REGISTRY_H

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
lounge_lizard-0.1.4 ext/drafter/src/refract/Registry.h
lounge_lizard-0.1.3 ext/drafter/src/refract/Registry.h
lounge_lizard-0.1.2 ext/drafter/src/refract/Registry.h
lounge_lizard-0.1.1 ext/drafter/src/refract/Registry.h
lounge_lizard-0.1.0 ext/drafter/src/refract/Registry.h