PageRenderTime 63ms CodeModel.GetById 39ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/llmessage/tests/llcurl_stub.cpp

https://bitbucket.org/lindenlab/viewer-beta/
C++ | 95 lines | 58 code | 12 blank | 25 comment | 4 complexity | 3e8ba1b7f69394e7b29c280542b712ea MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llcurl_stub.cpp
  3. * @brief stub class to allow unit testing
  4. *
  5. * $LicenseInfo:firstyear=2008&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 "llcurl.h"
  28. LLCurl::Responder::Responder()
  29. : mReferenceCount(0)
  30. {
  31. }
  32. void LLCurl::Responder::completed(U32 status, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const &reason,
  33. LLSD const& mContent)
  34. {
  35. if (isGoodStatus(status))
  36. {
  37. result(mContent);
  38. }
  39. else
  40. {
  41. errorWithContent(status, reason, mContent);
  42. }
  43. }
  44. void LLCurl::Responder::completedHeader(unsigned,
  45. std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&,
  46. LLSD const&)
  47. {
  48. }
  49. void LLCurl::Responder::completedRaw(unsigned,
  50. std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&,
  51. LLChannelDescriptors const&,
  52. boost::shared_ptr<LLBufferArray> const&)
  53. {
  54. }
  55. void LLCurl::Responder::errorWithContent(unsigned,
  56. std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&,
  57. LLSD const&)
  58. {
  59. }
  60. LLCurl::Responder::~Responder ()
  61. {
  62. }
  63. void LLCurl::Responder::error(unsigned,
  64. std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
  65. {
  66. }
  67. void LLCurl::Responder::result(LLSD const&)
  68. {
  69. }
  70. namespace boost
  71. {
  72. void intrusive_ptr_add_ref(LLCurl::Responder* p)
  73. {
  74. ++p->mReferenceCount;
  75. }
  76. void intrusive_ptr_release(LLCurl::Responder* p)
  77. {
  78. if(p && 0 == --p->mReferenceCount)
  79. {
  80. delete p;
  81. }
  82. }
  83. };