/indra/llcommon/lldictionary.cpp

https://bitbucket.org/lindenlab/viewer-beta/ · C++ · 47 lines · 17 code · 4 blank · 26 comment · 5 complexity · 78e84d350ffdae5e48966d539c2c5f11 MD5 · raw file

  1. /**
  2. * @file lldictionary.cpp
  3. * @brief Lldictionary class header file
  4. *
  5. * $LicenseInfo:firstyear=2002&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. #include "linden_common.h"
  27. #include "lldictionary.h"
  28. #include "llstring.h"
  29. // Define in .cpp file to prevent header include of llstring.h
  30. LLDictionaryEntry::LLDictionaryEntry(const std::string &name)
  31. : mName(name)
  32. {
  33. mNameCapitalized = mName;
  34. LLStringUtil::replaceChar(mNameCapitalized, '-', ' ');
  35. LLStringUtil::replaceChar(mNameCapitalized, '_', ' ');
  36. for (U32 i=0; i < mNameCapitalized.size(); i++)
  37. {
  38. if (i == 0 || mNameCapitalized[i-1] == ' ') // don't change ordering of this statement or crash
  39. {
  40. mNameCapitalized[i] = toupper(mNameCapitalized[i]);
  41. }
  42. }
  43. }