PageRenderTime 83ms CodeModel.GetById 0ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/llui/llrngwriter.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 63 lines | 28 code | 10 blank | 25 comment | 0 complexity | fdb08f428b3ca2c67f5bed170fe80cdf MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llrngwriter.h
  3. * @brief Generates Relax NG schema files from a param block
  4. *
  5. * $LicenseInfo:firstyear=2003&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2010, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. #ifndef LLRNGWRITER_H
  27. #define LLRNGWRITER_H
  28. #include "llinitparam.h"
  29. #include "llxmlnode.h"
  30. class LLRNGWriter : public LLInitParam::Parser
  31. {
  32. LOG_CLASS(LLRNGWriter);
  33. public:
  34. void writeRNG(const std::string& name, LLXMLNodePtr node, const LLInitParam::BaseBlock& block, const std::string& xml_namespace);
  35. void addDefinition(const std::string& type_name, const LLInitParam::BaseBlock& block);
  36. /*virtual*/ std::string getCurrentElementName() { return LLStringUtil::null; }
  37. LLRNGWriter();
  38. private:
  39. LLXMLNodePtr createCardinalityNode(LLXMLNodePtr parent_node, S32 min_count, S32 max_count);
  40. void addTypeNode(LLXMLNodePtr parent_node, const std::string& type, const std::vector<std::string>* possible_values);
  41. void writeAttribute(const std::string& type, const Parser::name_stack_t&, S32 min_count, S32 max_count, const std::vector<std::string>* possible_values);
  42. LLXMLNodePtr mElementNode;
  43. LLXMLNodePtr mChildrenNode;
  44. LLXMLNodePtr mGrammarNode;
  45. std::string mDefinitionName;
  46. typedef std::pair<LLXMLNodePtr, std::set<std::string> > attribute_data_t;
  47. typedef std::map<std::string, attribute_data_t> elements_map_t;
  48. typedef std::set<std::string> defined_elements_t;
  49. defined_elements_t mDefinedElements;
  50. attribute_data_t mAttributesWritten;
  51. elements_map_t mElementsWritten;
  52. };
  53. #endif //LLRNGWRITER_H