You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

112 lines
3.3 KiB

  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one or more
  3. * contributor license agreements. See the NOTICE file distributed with
  4. * this work for additional information regarding copyright ownership.
  5. * The ASF licenses this file to You under the Apache License, Version 2.0
  6. * (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. /*
  18. * $Id: Xlat_CppSrc.hpp 470094 2006-11-01 20:41:30Z amassari $
  19. */
  20. class CppSrcFormatter : public XlatFormatter
  21. {
  22. public :
  23. // -----------------------------------------------------------------------
  24. // Public Constructors and Destructor
  25. // -----------------------------------------------------------------------
  26. CppSrcFormatter() :
  27. fCurDomainName(0)
  28. , fFirst(true)
  29. , fOutFl(0)
  30. {
  31. }
  32. virtual ~CppSrcFormatter()
  33. {
  34. XMLString::release(&fCurDomainName);
  35. }
  36. // -----------------------------------------------------------------------
  37. // Implementation of the formatter interface
  38. // -----------------------------------------------------------------------
  39. virtual void endDomain
  40. (
  41. const XMLCh* const domainName
  42. , const unsigned int msgCount
  43. );
  44. virtual void endMsgType
  45. (
  46. const MsgTypes type
  47. );
  48. virtual void endOutput();
  49. virtual void nextMessage
  50. (
  51. const XMLCh* const msgText
  52. , const XMLCh* const msgId
  53. , const unsigned int messageId
  54. , const unsigned int curId
  55. );
  56. virtual void startDomain
  57. (
  58. const XMLCh* const domainName
  59. , const XMLCh* const nameSpace
  60. );
  61. virtual void startMsgType
  62. (
  63. const MsgTypes type
  64. );
  65. virtual void startOutput
  66. (
  67. const XMLCh* const locale
  68. , const XMLCh* const outPath
  69. );
  70. private :
  71. // -----------------------------------------------------------------------
  72. // Unimplemented constructors and operators
  73. // -----------------------------------------------------------------------
  74. CppSrcFormatter(const CppSrcFormatter&);
  75. void operator=(const CppSrcFormatter&);
  76. // -----------------------------------------------------------------------
  77. // Private data members
  78. //
  79. // fCurDomainName
  80. // This is the short name for the current domain being processed.
  81. // This is used to make the names of the array and array size
  82. // constant.
  83. //
  84. // fFirst
  85. // A trigger to catch the first message for a domain and do some
  86. // slightly different formatting.
  87. //
  88. // fOutFl
  89. // This is the current output file. Its created when a new domain
  90. // is begun via startDomain() and closed when endDomain is called.
  91. // -----------------------------------------------------------------------
  92. XMLCh* fCurDomainName;
  93. bool fFirst;
  94. FILE* fOutFl;
  95. };