Leaked source code of windows server 2003
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.

174 lines
3.9 KiB

  1. //-----------------------------------------------------------------------------
  2. //
  3. // File: locid.inl
  4. // Copyright (C) 1994-1997 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // In line definitions for the CLocID class. This fgile should ONLY be
  8. // included by locid.h
  9. //
  10. //-----------------------------------------------------------------------------
  11. //-----------------------------------------------------------------------------
  12. //
  13. // Implementation. Clears the contents of the ID. Both parts are marked
  14. // invalid.
  15. //
  16. //-----------------------------------------------------------------------------
  17. inline
  18. void
  19. CLocId::ClearId(void)
  20. {
  21. m_fHasNumericId = FALSE;
  22. m_fHasStringId = FALSE;
  23. m_ulNumericId = 0;
  24. m_pstrStringId.ClearString();
  25. }
  26. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  27. //
  28. // Constuctor for a localization ID. Sets it to have no valid ID.
  29. //
  30. //-----------------------------------------------------------------------------
  31. inline
  32. CLocId::CLocId()
  33. {
  34. ClearId();
  35. DEBUGONLY(++m_UsageCounter);
  36. }
  37. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  38. //
  39. // Tests if the numeric ID is valid.
  40. //
  41. //-----------------------------------------------------------------------------
  42. inline
  43. BOOL // TRUE means the numeric ID is valid
  44. CLocId::HasNumericId(void)
  45. const
  46. {
  47. return m_fHasNumericId;
  48. }
  49. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  50. //
  51. // Tests if the string ID is valid.
  52. //
  53. //-----------------------------------------------------------------------------
  54. inline
  55. BOOL // TRUE means the string ID is valid
  56. CLocId::HasStringId(void)
  57. const
  58. {
  59. return m_fHasStringId;
  60. }
  61. inline
  62. BOOL
  63. CLocId::IsNull(void)
  64. const
  65. {
  66. return
  67. !HasStringId() &&
  68. !HasNumericId();
  69. }
  70. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  71. //
  72. // Returns the current numeric ID. If the ID is invalid, the ID will be
  73. // zero.
  74. //
  75. //-----------------------------------------------------------------------------
  76. inline
  77. BOOL // TRUE indicates the ID is valid
  78. CLocId::GetId(
  79. ULONG &ulNumericId) // Location to put ID
  80. const
  81. {
  82. ulNumericId = m_ulNumericId;
  83. return m_fHasNumericId;
  84. }
  85. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  86. //
  87. // Returns the current string ID. If the ID is invalid, it will be a NULL
  88. // string.
  89. //
  90. //-----------------------------------------------------------------------------
  91. inline
  92. BOOL // TRUE indicates the ID is valid
  93. CLocId::GetId(
  94. CPascalString &pstrStringId) // Location to put the ID.
  95. const
  96. {
  97. pstrStringId = m_pstrStringId;
  98. return m_fHasStringId;
  99. }
  100. //-----------------------------------------------------------------------------
  101. //
  102. // Checks if the ID has been assigned to before. If it has, throw an
  103. // exception.
  104. //
  105. //-----------------------------------------------------------------------------
  106. inline
  107. void
  108. CLocId::CheckPreviousAssignment(void)
  109. const
  110. {
  111. if (m_fHasStringId || m_fHasNumericId)
  112. {
  113. AfxThrowNotSupportedException();
  114. }
  115. }
  116. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  117. //
  118. // Compares two ID's to see if they are the same.
  119. //
  120. //-----------------------------------------------------------------------------
  121. inline
  122. int
  123. CLocId::operator==(
  124. const CLocId &lidOther) // ID to compare to
  125. const
  126. {
  127. return IsIdenticalTo(lidOther);
  128. }
  129. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  130. //
  131. // Checks for in-equality between two ID's
  132. //
  133. //-----------------------------------------------------------------------------
  134. inline
  135. int
  136. CLocId::operator!=(
  137. const CLocId &lidOther)
  138. const
  139. {
  140. return !IsIdenticalTo(lidOther);
  141. }