acsymutl.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright 2015 Autodesk, Inc. All rights reserved.
  4. //
  5. // Use of this software is subject to the terms of the Autodesk license
  6. // agreement provided at the time of installation or download, or which
  7. // otherwise accompanies this software in either electronic or hard copy form.
  8. //
  9. //////////////////////////////////////////////////////////////////////////////
  10. // DESCRIPTION:
  11. //
  12. // Namespace AcEdSymbolUtilities contains various AutoCAD-specific
  13. // utilities for working with symbol names, symbol records, and symbol
  14. // tables. The main access to the utility functions is through
  15. // "acedSymUtil()", which you dereference to call the member
  16. // functions of AcEdSymbolUtilities::Services.
  17. //
  18. #ifndef _ACSYMUTL_H
  19. #define _ACSYMUTL_H
  20. #include <assert.h>
  21. #include "acadstrc.h"
  22. #include "dbsymutl.h"
  23. #pragma pack (push, 8)
  24. #define ACEDSYMUTIL_SERVICES_CURRENT_VERSION 100
  25. class AcDbDatabase;
  26. namespace AcEdSymbolUtilities
  27. {
  28. enum CrSpMode {
  29. kCrEndsInput = true
  30. , kCrSpEndsInput = false
  31. };
  32. enum NameCaseMode {
  33. kPreserveCase = true
  34. , kForceToUpper = false
  35. };
  36. class Services
  37. {
  38. public:
  39. enum { kCurrentVersion = ACEDSYMUTIL_SERVICES_CURRENT_VERSION };
  40. virtual unsigned version() const = 0;
  41. virtual Acad::PromptStatus getCompatibleSymbolString(
  42. ACHAR*& pResponse,
  43. const ACHAR* prompt,
  44. AcDbDatabase * pDb) const = 0;
  45. virtual Acad::PromptStatus getSymbolString(
  46. ACHAR*& pResponse,
  47. const ACHAR* prompt,
  48. bool onlyCrEndsInput,
  49. bool preserveCase) const = 0;
  50. }; // End Services
  51. // For use by AcEdSymbolUtilities only!
  52. #define ACEDSYMUTIL_SERVICESNAME_WITH_VERSION_1(n,v) n ## v
  53. #define ACEDSYMUTIL_SERVICESNAME_WITH_VERSION(n,v) \
  54. ACEDSYMUTIL_SERVICESNAME_WITH_VERSION_1(n,v)
  55. #define ACEDSYMUTIL_SERVICES_NAME \
  56. ACEDSYMUTIL_SERVICESNAME_WITH_VERSION( \
  57. servicesPtr, \
  58. ACEDSYMUTIL_SERVICES_CURRENT_VERSION)
  59. extern const Services * ACEDSYMUTIL_SERVICES_NAME();
  60. // --------- Inline definitions ---------
  61. inline const Services *
  62. servicesPtr()
  63. {
  64. const Services * pSymUtil = ACEDSYMUTIL_SERVICES_NAME();
  65. assert(pSymUtil != 0);
  66. assert(pSymUtil->version() == Services::kCurrentVersion);
  67. return pSymUtil;
  68. }
  69. } // End AcEdSymbolUtilities
  70. namespace AcEdSymUtil = AcEdSymbolUtilities;
  71. typedef AcEdSymbolUtilities::Services AcEdSymUtilServices;
  72. inline const AcEdSymUtilServices *
  73. acedSymUtil()
  74. {
  75. return AcEdSymbolUtilities::servicesPtr();
  76. }
  77. #pragma pack (pop)
  78. #endif // _ACSYMUTL_H