rippled
STBlob.cpp
1 //------------------------------------------------------------------------------
2 /*
3  This file is part of rippled: https://github.com/ripple/rippled
4  Copyright (c) 2012, 2013 Ripple Labs Inc.
5 
6  Permission to use, copy, modify, and/or distribute this software for any
7  purpose with or without fee is hereby granted, provided that the above
8  copyright notice and this permission notice appear in all copies.
9 
10  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18 //==============================================================================
19 
20 #include <ripple/basics/StringUtilities.h>
21 #include <ripple/protocol/STBlob.h>
22 
23 namespace ripple {
24 
25 STBlob::STBlob(SerialIter& st, SField const& name)
26  : STBase(name), value_(st.getVLBuffer())
27 {
28 }
29 
32 {
33  return strHex(value_);
34 }
35 
36 bool
38 {
39  const STBlob* v = dynamic_cast<const STBlob*>(&t);
40  return v && (value_ == v->value_);
41 }
42 
43 } // namespace ripple
ripple::STBlob::STBlob
STBlob()=default
std::string
STL class.
ripple::STBlob::value_
Buffer value_
Definition: STBlob.h:136
ripple::STBlob::getText
std::string getText() const override
Definition: STBlob.cpp:31
ripple::SerialIter
Definition: Serializer.h:310
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::SField
Identifies fields.
Definition: SField.h:109
ripple::STBase
A type which can be exported to a well known binary format.
Definition: STBase.h:62
ripple::STBlob::isEquivalent
bool isEquivalent(const STBase &t) const override
Definition: STBlob.cpp:37
ripple::strHex
std::string strHex(FwdIt begin, FwdIt end)
Definition: strHex.h:45
ripple::STBlob
Definition: STBlob.h:33