rippled
Version.h
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 #ifndef RIPPLED_RIPPLE_RPC_HANDLERS_VERSION_H
21 #define RIPPLED_RIPPLE_RPC_HANDLERS_VERSION_H
22 
23 #include <ripple/rpc/impl/RPCHelpers.h>
24 
25 namespace ripple {
26 namespace RPC {
27 
29 {
30 public:
31  explicit VersionHandler (JsonContext&) {}
32 
34  {
35  return Status::OK;
36  }
37 
38  template <class Object>
39  void writeResult (Object& obj)
40  {
41  setVersion (obj);
42  }
43 
44  static char const* name()
45  {
46  return "version";
47  }
48 
49  static Role role()
50  {
51  return Role::USER;
52  }
53 
55  {
56  return NO_CONDITION;
57  }
58 };
59 
60 } // RPC
61 } // ripple
62 
63 #endif
ripple::RPC::Status::OK
static constexpr Code OK
Definition: Status.h:46
ripple::RPC::JsonContext
Definition: Context.h:52
ripple::RPC::VersionHandler::condition
static Condition condition()
Definition: Version.h:54
ripple::RPC::VersionHandler
Definition: Version.h:28
ripple::RPC::VersionHandler::role
static Role role()
Definition: Version.h:49
ripple::Role::USER
@ USER
ripple::RPC::NO_CONDITION
@ NO_CONDITION
Definition: Handler.h:40
ripple::RPC::VersionHandler::name
static char const * name()
Definition: Version.h:44
ripple::RPC::Condition
Condition
Definition: Handler.h:39
ripple::RPC::Status
Status represents the results of an operation that might fail.
Definition: Status.h:39
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::RPC::VersionHandler::VersionHandler
VersionHandler(JsonContext &)
Definition: Version.h:31
ripple::RPC::VersionHandler::writeResult
void writeResult(Object &obj)
Definition: Version.h:39
ripple::RPC::setVersion
void setVersion(Object &parent)
Definition: RPCHelpers.h:212
ripple::Role
Role
Indicates the level of administrative permission to grant.
Definition: Role.h:40
ripple::RPC::VersionHandler::check
Status check()
Definition: Version.h:33