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.

180 lines
3.8 KiB

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