Open-Transactions  0.93.0-ge03d287
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
opentxs::OTDB Namespace Reference

Namespaces

 details
 

Classes

class  InitOTDBDetails
 
class  Storable
 
class  PackedBuffer
 
class  OTPacker
 
class  PackerSubclass
 
class  Storage
 
class  OTDBString
 
class  Blob
 
class  StringMap
 
class  Displayable
 
class  MarketData
 
class  MarketList
 
class  OfferDataMarket
 
class  BidData
 
class  AskData
 
class  OfferListMarket
 
class  TradeDataMarket
 
class  TradeListMarket
 
class  OfferDataNym
 
class  OfferListNym
 
class  TradeDataNym
 
class  TradeListNym
 
class  Acct
 
class  BitcoinAcct
 
class  ServerInfo
 
class  Server
 
class  BitcoinServer
 
class  RippleServer
 
class  LoomServer
 
class  ContactNym
 
class  WalletData
 
class  ContactAcct
 
class  Contact
 
class  AddressBook
 
class  StorageFS
 

Typedefs

typedef Storable *( InstantiateFunc )()
 
typedef std::pair< PackType,
StoredObjectType
InstantiateFuncKey
 
typedef std::map
< InstantiateFuncKey,
InstantiateFunc * > 
mapOfFunctions
 

Enumerations

enum  PackType { PACK_MESSAGE_PACK = 0, PACK_PROTOCOL_BUFFERS, PACK_TYPE_ERROR }
 
enum  StorageType { STORE_FILESYSTEM = 0, STORE_TYPE_SUBCLASS }
 
enum  StoredObjectType {
  STORED_OBJ_STRING = 0, STORED_OBJ_BLOB, STORED_OBJ_STRING_MAP, STORED_OBJ_WALLET_DATA,
  STORED_OBJ_BITCOIN_ACCT, STORED_OBJ_BITCOIN_SERVER, STORED_OBJ_RIPPLE_SERVER, STORED_OBJ_LOOM_SERVER,
  STORED_OBJ_SERVER_INFO, STORED_OBJ_CONTACT_NYM, STORED_OBJ_CONTACT_ACCT, STORED_OBJ_CONTACT,
  STORED_OBJ_ADDRESS_BOOK, STORED_OBJ_MARKET_DATA, STORED_OBJ_MARKET_LIST, STORED_OBJ_BID_DATA,
  STORED_OBJ_ASK_DATA, STORED_OBJ_OFFER_LIST_MARKET, STORED_OBJ_TRADE_DATA_MARKET, STORED_OBJ_TRADE_LIST_MARKET,
  STORED_OBJ_OFFER_DATA_NYM, STORED_OBJ_OFFER_LIST_NYM, STORED_OBJ_TRADE_DATA_NYM, STORED_OBJ_TRADE_LIST_NYM,
  STORED_OBJ_ERROR
}
 

Functions

 DeclareInterface (IStorable) virtual bool onPack(PackedBuffer &theBuffer
 
virtual bool onUnpack (PackedBuffer &theBuffer, Storable &outObj)=0
 
virtual void hookBeforePack ()
 
virtual void hookAfterUnpack ()
 
EXPORT bool InitDefaultStorage (StorageType eStoreType, PackType ePackType)
 
EXPORT StorageGetDefaultStorage ()
 
EXPORT StorageCreateStorageContext (StorageType eStoreType, PackType ePackType=OTDB_DEFAULT_PACKER)
 
EXPORT StorableCreateObject (StoredObjectType eType)
 
EXPORT bool CheckStringsExistInOrder (std::string &strFolder, std::string &oneStr, std::string &twoStr, std::string &threeStr, const char *szFuncName=nullptr)
 
EXPORT bool Exists (std::string strFolder, std::string oneStr="", std::string twoStr="", std::string threeStr="")
 
EXPORT int64_t FormPathString (std::string &strOutput, std::string strFolder, std::string oneStr="", std::string twoStr="", std::string threeStr="")
 
EXPORT bool StoreString (std::string strContents, std::string strFolder, std::string oneStr="", std::string twoStr="", std::string threeStr="")
 
EXPORT std::string QueryString (std::string strFolder, std::string oneStr="", std::string twoStr="", std::string threeStr="")
 
EXPORT bool StorePlainString (std::string strContents, std::string strFolder, std::string oneStr="", std::string twoStr="", std::string threeStr="")
 
EXPORT std::string QueryPlainString (std::string strFolder, std::string oneStr="", std::string twoStr="", std::string threeStr="")
 
EXPORT bool StoreObject (Storable &theContents, std::string strFolder, std::string oneStr="", std::string twoStr="", std::string threeStr="")
 
EXPORT StorableQueryObject (StoredObjectType theObjectType, std::string strFolder, std::string oneStr="", std::string twoStr="", std::string threeStr="")
 
EXPORT std::string EncodeObject (Storable &theContents)
 
EXPORT StorableDecodeObject (StoredObjectType theObjectType, std::string strInput)
 
EXPORT bool EraseValueByKey (std::string strFolder, std::string oneStr="", std::string twoStr="", std::string threeStr="")
 
 IMPLEMENT_GET_ADD_REMOVE (WalletData::, BitcoinServer) IMPLEMENT_GET_ADD_REMOVE(WalletData
 

Variables

const char * StoredObjectTypeStrings []
 
StorableinObj = 0
 
InitOTDBDetails theOTDBConstructor
 

Typedef Documentation

typedef Storable*( opentxs::OTDB::InstantiateFunc)()

Definition at line 327 of file OTStorage.hpp.

Definition at line 329 of file OTStorage.hpp.

Definition at line 340 of file OTStorage.hpp.

Enumeration Type Documentation

Enumerator
PACK_MESSAGE_PACK 
PACK_PROTOCOL_BUFFERS 
PACK_TYPE_ERROR 

Definition at line 221 of file OTStorage.hpp.

222 { PACK_MESSAGE_PACK = 0, // Using MessagePack as packer.
223  PACK_PROTOCOL_BUFFERS, // Using Google Protocol Buffers as packer.
224  PACK_TYPE_ERROR // (Should never be.)
225 };
Enumerator
STORE_FILESYSTEM 
STORE_TYPE_SUBCLASS 

Definition at line 229 of file OTStorage.hpp.

230 { STORE_FILESYSTEM = 0, // Filesystem
231  // STORE_COUCH_DB, // Couch DB (not yet supported)
232  STORE_TYPE_SUBCLASS // (Subclass provided by API client via SWIG.)
233 };
Enumerator
STORED_OBJ_STRING 
STORED_OBJ_BLOB 
STORED_OBJ_STRING_MAP 
STORED_OBJ_WALLET_DATA 
STORED_OBJ_BITCOIN_ACCT 
STORED_OBJ_BITCOIN_SERVER 
STORED_OBJ_RIPPLE_SERVER 
STORED_OBJ_LOOM_SERVER 
STORED_OBJ_SERVER_INFO 
STORED_OBJ_CONTACT_NYM 
STORED_OBJ_CONTACT_ACCT 
STORED_OBJ_CONTACT 
STORED_OBJ_ADDRESS_BOOK 
STORED_OBJ_MARKET_DATA 
STORED_OBJ_MARKET_LIST 
STORED_OBJ_BID_DATA 
STORED_OBJ_ASK_DATA 
STORED_OBJ_OFFER_LIST_MARKET 
STORED_OBJ_TRADE_DATA_MARKET 
STORED_OBJ_TRADE_LIST_MARKET 
STORED_OBJ_OFFER_DATA_NYM 
STORED_OBJ_OFFER_LIST_NYM 
STORED_OBJ_TRADE_DATA_NYM 
STORED_OBJ_TRADE_LIST_NYM 
STORED_OBJ_ERROR 

Definition at line 242 of file OTStorage.hpp.

242  {
243  STORED_OBJ_STRING = 0, // Just a string.
244  STORED_OBJ_BLOB, // Used for storing binary data. Bytes of arbitrary length.
245  STORED_OBJ_STRING_MAP, // A StringMap is a list of Key/Value pairs, useful
246  // for storing nearly anything.
247  STORED_OBJ_WALLET_DATA, // The GUI wallet's stored data
248  STORED_OBJ_BITCOIN_ACCT, // The GUI wallet's stored data about a Bitcoin
249  // acct
250  STORED_OBJ_BITCOIN_SERVER, // The GUI wallet's stored data about a Bitcoin
251  // RPC port.
252  STORED_OBJ_RIPPLE_SERVER, // The GUI wallet's stored data about a Ripple
253  // server.
254  STORED_OBJ_LOOM_SERVER, // The GUI wallet's stored data about a Loom server.
255  STORED_OBJ_SERVER_INFO, // A Nym has a list of these.
256  STORED_OBJ_CONTACT_NYM, // This is a Nym record inside a contact of your
257  // address book.
258  STORED_OBJ_CONTACT_ACCT, // This is an account record inside a contact of
259  // your address book.
260  STORED_OBJ_CONTACT, // Your address book has a list of these.
261  STORED_OBJ_ADDRESS_BOOK, // Your address book.
262  STORED_OBJ_MARKET_DATA, // The description data for any given Market ID.
263  STORED_OBJ_MARKET_LIST, // A list of MarketDatas.
264  STORED_OBJ_BID_DATA, // Offer details (doesn't contain private details)
265  STORED_OBJ_ASK_DATA, // Offer details (doesn't contain private details)
266  STORED_OBJ_OFFER_LIST_MARKET, // A list of offer details, for a specific
267  // market.
268  STORED_OBJ_TRADE_DATA_MARKET, // Trade details (doesn't contain private
269  // data)
270  STORED_OBJ_TRADE_LIST_MARKET, // A list of trade details, for a specific
271  // market.
272  STORED_OBJ_OFFER_DATA_NYM, // Private offer details for a particular Nym and
273  // Offer.
274  STORED_OBJ_OFFER_LIST_NYM, // A list of private offer details for a
275  // particular Nym.
276  STORED_OBJ_TRADE_DATA_NYM, // Private trade details for a particular Nym and
277  // Trade.
278  STORED_OBJ_TRADE_LIST_NYM, // A list of private trade details for a
279  // particular Nym and Offer.
280  STORED_OBJ_ERROR // (Should never be.)
281 };

Function Documentation

bool opentxs::OTDB::CheckStringsExistInOrder ( std::string &  strFolder,
std::string &  oneStr,
std::string &  twoStr,
std::string &  threeStr,
const char *  szFuncName = nullptr 
)

Definition at line 549 of file OTStorage.cpp.

552 {
553  if (nullptr == szFuncName) szFuncName = __FUNCTION__;
554 
555  OTString ot_strFolder(strFolder), ot_oneStr(oneStr), ot_twoStr(twoStr),
556  ot_threeStr(threeStr);
557 
558  if (ot_strFolder.Exists()) {
559  if (!ot_oneStr.Exists()) {
560  if ((!ot_twoStr.Exists()) && (!ot_threeStr.Exists())) {
561  oneStr = strFolder;
562  strFolder = ".";
563  }
564  else {
565  otErr << szFuncName << ": ot_twoStr or ot_threeStr exist, when "
566  "ot_oneStr doesn't exist! \n";
567  OT_FAIL;
568  }
569  }
570  else if ((!ot_twoStr.Exists()) && (ot_threeStr.Exists())) {
571  otErr << szFuncName << ": ot_twoStr or ot_threeStr exist, when "
572  "ot_oneStr doesn't exist! \n";
573  OT_FAIL;
574  }
575  }
576  else {
577  otErr << szFuncName << ": ot_strFolder must always exist!\n";
578  OT_FAIL;
579  }
580  return true;
581 }
#define OT_FAIL
Definition: Assert.hpp:139
OTLOG_IMPORT OTLogStream otErr
Storable * opentxs::OTDB::CreateObject ( StoredObjectType  eType)

Definition at line 530 of file OTStorage.cpp.

531 {
532  Storage* pStorage = details::s_pStorage;
533 
534  if (nullptr == pStorage) {
535  return nullptr;
536  }
537 
538  return pStorage->CreateObject(eType);
539 }
EXPORT Storable * CreateObject(StoredObjectType eType)
Definition: OTStorage.cpp:2128
OTDB::Storage * s_pStorage
Definition: OTStorage.cpp:293
Storage * opentxs::OTDB::CreateStorageContext ( StorageType  eStoreType,
PackType  ePackType = OTDB_DEFAULT_PACKER 
)

Definition at line 522 of file OTStorage.cpp.

523 {
524  Storage* pStorage = Storage::Create(eStoreType, ePackType);
525 
526  return pStorage; // caller responsible to delete
527 }
opentxs::OTDB::DeclareInterface ( IStorable  )
Storable * opentxs::OTDB::DecodeObject ( StoredObjectType  theObjectType,
std::string  strInput 
)

Definition at line 830 of file OTStorage.cpp.

831 {
832  Storage* pStorage = details::s_pStorage;
833 
834  if (nullptr == pStorage) {
835  return nullptr;
836  }
837 
838  return pStorage->DecodeObject(theObjectType, strInput);
839 }
EXPORT Storable * DecodeObject(StoredObjectType theObjectType, std::string strInput)
Definition: OTStorage.cpp:2435
OTDB::Storage * s_pStorage
Definition: OTStorage.cpp:293
std::string opentxs::OTDB::EncodeObject ( Storable &  theContents)

Definition at line 818 of file OTStorage.cpp.

819 {
820  Storage* pStorage = details::s_pStorage;
821 
822  if (nullptr == pStorage) {
823  otErr << "OTDB::EncodeObject: No Default Storage object allocated.\n";
824  return "";
825  }
826  return pStorage->EncodeObject(theContents);
827 }
OTDB::Storage * s_pStorage
Definition: OTStorage.cpp:293
OTLOG_IMPORT OTLogStream otErr
bool opentxs::OTDB::EraseValueByKey ( std::string  strFolder,
std::string  oneStr = "",
std::string  twoStr = "",
std::string  threeStr = "" 
)

Definition at line 843 of file OTStorage.cpp.

845 {
846  Storage* pStorage = details::s_pStorage;
847 
848  if (nullptr == pStorage) {
849  otErr
850  << "OTDB::EraseValueByKey: No Default Storage object allocated.\n";
851  return false;
852  }
853 
854  return pStorage->EraseValueByKey(strFolder, oneStr, twoStr, threeStr);
855 }
OTDB::Storage * s_pStorage
Definition: OTStorage.cpp:293
OTLOG_IMPORT OTLogStream otErr
bool opentxs::OTDB::Exists ( std::string  strFolder,
std::string  oneStr = "",
std::string  twoStr = "",
std::string  threeStr = "" 
)

Definition at line 584 of file OTStorage.cpp.

586 {
587  {
588  OTString ot_strFolder(strFolder), ot_oneStr(oneStr), ot_twoStr(twoStr),
589  ot_threeStr(threeStr);
590  OT_ASSERT_MSG(ot_strFolder.Exists(),
591  "OTDB::Exists: strFolder is empty.");
592 
593  if (!ot_oneStr.Exists()) {
594  OT_ASSERT_MSG((!ot_twoStr.Exists() && !ot_threeStr.Exists()),
595  "Exists: bad options");
596  oneStr = strFolder;
597  strFolder = ".";
598  }
599  }
600 
601  Storage* pStorage = details::s_pStorage;
602 
603  if (nullptr == pStorage) {
604  otOut << "OTDB::" << __FUNCTION__
605  << ": details::s_pStorage is null. (Returning false.)\n";
606  return false;
607  }
608 
609  return pStorage->Exists(strFolder, oneStr, twoStr, threeStr);
610 }
OTLOG_IMPORT OTLogStream otOut
OTDB::Storage * s_pStorage
Definition: OTStorage.cpp:293
#define OT_ASSERT_MSG(x, s)
Definition: Assert.hpp:155
int64_t opentxs::OTDB::FormPathString ( std::string &  strOutput,
std::string  strFolder,
std::string  oneStr = "",
std::string  twoStr = "",
std::string  threeStr = "" 
)

Definition at line 612 of file OTStorage.cpp.

615 {
616  {
617  OTString ot_strFolder(strFolder), ot_oneStr(oneStr), ot_twoStr(twoStr),
618  ot_threeStr(threeStr);
619  OT_ASSERT_MSG(ot_strFolder.Exists(),
620  "OTDB::FormPathString: strFolder is empty.");
621 
622  if (!ot_oneStr.Exists()) {
623  OT_ASSERT_MSG((!ot_twoStr.Exists() && !ot_threeStr.Exists()),
624  "FormPathString: bad options");
625  oneStr = strFolder;
626  strFolder = ".";
627  }
628  }
629 
630  Storage* pStorage = details::s_pStorage;
631 
632  if (nullptr == pStorage) {
633  otOut << "OTDB::" << __FUNCTION__
634  << ": details::s_pStorage is null. (Returning -1.)\n";
635  return -1;
636  }
637 
638  return pStorage->FormPathString(strOutput, strFolder, oneStr, twoStr,
639  threeStr);
640 }
OTLOG_IMPORT OTLogStream otOut
OTDB::Storage * s_pStorage
Definition: OTStorage.cpp:293
#define OT_ASSERT_MSG(x, s)
Definition: Assert.hpp:155
Storage * opentxs::OTDB::GetDefaultStorage ( )

Definition at line 480 of file OTStorage.cpp.

481 {
483 }
OTDB::Storage * s_pStorage
Definition: OTStorage.cpp:293
virtual void opentxs::OTDB::hookAfterUnpack ( )
virtual

Definition at line 384 of file OTStorage.hpp.

385 {
386 } // This is called just after unpacking a storable. (Opportunity to copy
virtual void opentxs::OTDB::hookBeforePack ( )
virtual

Definition at line 380 of file OTStorage.hpp.

381 {
382 } // This is called just before packing a storable. (Opportunity to copy
opentxs::OTDB::IMPLEMENT_GET_ADD_REMOVE ( WalletData::  ,
BitcoinServer   
)

Definition at line 1061 of file OTStorage.cpp.

1104 {
1105  // while (GetServerInfoCount() > 0)
1106  // RemoveServerInfo(0);
1107 }
bool opentxs::OTDB::InitDefaultStorage ( StorageType  eStoreType,
PackType  ePackType 
)

Definition at line 491 of file OTStorage.cpp.

492 {
493  // This allows you to call multiple times if you want to change the default
494  // storage.
495  //
496  // if (nullptr != details::s_pStorage)
497  // {
498  // otErr << "OTDB::InitDefaultStorage: Existing storage context
499  // already exists. (Erasing / replacing it.)\n";
500  //
501  // delete details::s_pStorage;
502  // details::s_pStorage = nullptr;
503  // }
504 
505  if (nullptr == details::s_pStorage) {
506  otInfo << "OTDB::InitDefaultStorage: Existing storage context doesn't "
507  "already exist. (Creating it.)\n";
508 
509  details::s_pStorage = Storage::Create(eStoreType, ePackType);
510  }
511 
512  if (nullptr == details::s_pStorage) {
513  otErr << "OTDB::InitDefaultStorage: Failed while calling "
514  "OTDB::Storage::Create()\n";
515  return false;
516  }
517 
518  return true;
519 }
OTDB::Storage * s_pStorage
Definition: OTStorage.cpp:293
OTLOG_IMPORT OTLogStream otInfo
OTLOG_IMPORT OTLogStream otErr
virtual bool opentxs::OTDB::onUnpack ( PackedBuffer &  theBuffer,
Storable &  outObj 
)
pure virtual
Storable * opentxs::OTDB::QueryObject ( StoredObjectType  theObjectType,
std::string  strFolder,
std::string  oneStr = "",
std::string  twoStr = "",
std::string  threeStr = "" 
)

Definition at line 788 of file OTStorage.cpp.

791 {
792  {
793  OTString ot_strFolder(strFolder), ot_oneStr(oneStr), ot_twoStr(twoStr),
794  ot_threeStr(threeStr);
795  OT_ASSERT_MSG(ot_strFolder.Exists(),
796  "OTDB::QueryObject: strFolder is null");
797 
798  if (!ot_oneStr.Exists()) {
799  OT_ASSERT_MSG((!ot_twoStr.Exists() && !ot_threeStr.Exists()),
800  "OTDB::QueryObject: bad options");
801  oneStr = strFolder;
802  strFolder = ".";
803  }
804  }
805 
806  Storage* pStorage = details::s_pStorage;
807 
808  if (nullptr == pStorage) {
809  return nullptr;
810  }
811 
812  return pStorage->QueryObject(theObjectType, strFolder, oneStr, twoStr,
813  threeStr);
814 }
OTDB::Storage * s_pStorage
Definition: OTStorage.cpp:293
#define OT_ASSERT_MSG(x, s)
Definition: Assert.hpp:155
EXPORT Storable * QueryObject(StoredObjectType theObjectType, std::string strFolder, std::string oneStr="", std::string twoStr="", std::string threeStr="")
Definition: OTStorage.cpp:2336
std::string opentxs::OTDB::QueryPlainString ( std::string  strFolder,
std::string  oneStr = "",
std::string  twoStr = "",
std::string  threeStr = "" 
)

Definition at line 728 of file OTStorage.cpp.

730 {
731  {
732  OTString ot_strFolder(strFolder), ot_oneStr(oneStr), ot_twoStr(twoStr),
733  ot_threeStr(threeStr);
734  OT_ASSERT_MSG(ot_strFolder.Exists(),
735  "OTDB::QueryPlainString: strFolder is null");
736 
737  if (!ot_oneStr.Exists()) {
738  OT_ASSERT_MSG((!ot_twoStr.Exists() && !ot_threeStr.Exists()),
739  "OTDB::QueryPlainString: bad options");
740  oneStr = strFolder;
741  strFolder = ".";
742  }
743  }
744 
745  Storage* pStorage = details::s_pStorage;
746 
747  OT_ASSERT((strFolder.length() > 3) || (0 == strFolder.compare(0, 1, ".")));
748  OT_ASSERT((oneStr.length() < 1) || (oneStr.length() > 3));
749 
750  if (nullptr == pStorage) {
751  return std::string("");
752  }
753 
754  return pStorage->QueryPlainString(strFolder, oneStr, twoStr, threeStr);
755 }
#define OT_ASSERT(x)
Definition: Assert.hpp:150
OTDB::Storage * s_pStorage
Definition: OTStorage.cpp:293
#define OT_ASSERT_MSG(x, s)
Definition: Assert.hpp:155
std::string opentxs::OTDB::QueryString ( std::string  strFolder,
std::string  oneStr = "",
std::string  twoStr = "",
std::string  threeStr = "" 
)

Definition at line 671 of file OTStorage.cpp.

673 {
674  {
675  OTString ot_strFolder(strFolder), ot_oneStr(oneStr), ot_twoStr(twoStr),
676  ot_threeStr(threeStr);
677 
678  if (!CheckStringsExistInOrder(strFolder, oneStr, twoStr, threeStr,
679  __FUNCTION__))
680  return std::string("");
681 
682  if (!ot_oneStr.Exists()) {
683  OT_ASSERT_MSG((!ot_twoStr.Exists() && !ot_threeStr.Exists()),
684  "Storage::StoreString: bad options");
685  oneStr = strFolder;
686  strFolder = ".";
687  }
688  }
689  Storage* pStorage = details::s_pStorage;
690 
691  if (nullptr == pStorage) return std::string("");
692 
693  return pStorage->QueryString(strFolder, oneStr, twoStr, threeStr);
694 }
EXPORT bool CheckStringsExistInOrder(std::string &strFolder, std::string &oneStr, std::string &twoStr, std::string &threeStr, const char *szFuncName=nullptr)
Definition: OTStorage.cpp:549
OTDB::Storage * s_pStorage
Definition: OTStorage.cpp:293
#define OT_ASSERT_MSG(x, s)
Definition: Assert.hpp:155
bool opentxs::OTDB::StoreObject ( Storable &  theContents,
std::string  strFolder,
std::string  oneStr = "",
std::string  twoStr = "",
std::string  threeStr = "" 
)

Definition at line 759 of file OTStorage.cpp.

761 {
762  {
763  OTString ot_strFolder(strFolder), ot_oneStr(oneStr), ot_twoStr(twoStr),
764  ot_threeStr(threeStr);
765  OT_ASSERT_MSG(ot_strFolder.Exists(),
766  "OTDB:StoreObject: strFolder is null");
767 
768  if (!ot_oneStr.Exists()) {
769  OT_ASSERT_MSG((!ot_twoStr.Exists() && !ot_threeStr.Exists()),
770  "OTDB:StoreObject: bad options");
771  oneStr = strFolder;
772  strFolder = ".";
773  }
774  }
775 
776  Storage* pStorage = details::s_pStorage;
777 
778  if (nullptr == pStorage) {
779  otErr << "OTDB::StoreObject: No default storage object allocated.\n";
780  return false;
781  }
782 
783  return pStorage->StoreObject(theContents, strFolder, oneStr, twoStr,
784  threeStr);
785 }
OTDB::Storage * s_pStorage
Definition: OTStorage.cpp:293
#define OT_ASSERT_MSG(x, s)
Definition: Assert.hpp:155
OTLOG_IMPORT OTLogStream otErr
bool opentxs::OTDB::StorePlainString ( std::string  strContents,
std::string  strFolder,
std::string  oneStr = "",
std::string  twoStr = "",
std::string  threeStr = "" 
)

Definition at line 698 of file OTStorage.cpp.

701 {
702  {
703  OTString ot_strFolder(strFolder), ot_oneStr(oneStr), ot_twoStr(twoStr),
704  ot_threeStr(threeStr);
705  OT_ASSERT_MSG(ot_strFolder.Exists(),
706  "OTDB::StorePlainString: strFolder is null");
707 
708  if (!ot_oneStr.Exists()) {
709  OT_ASSERT_MSG((!ot_twoStr.Exists() && !ot_threeStr.Exists()),
710  "OTDB::StorePlainString: bad options");
711  oneStr = strFolder;
712  strFolder = ".";
713  }
714  }
715  Storage* pStorage = details::s_pStorage;
716 
717  OT_ASSERT((strFolder.length() > 3) || (0 == strFolder.compare(0, 1, ".")));
718  OT_ASSERT((oneStr.length() < 1) || (oneStr.length() > 3));
719 
720  if (nullptr == pStorage) {
721  return false;
722  }
723 
724  return pStorage->StorePlainString(strContents, strFolder, oneStr, twoStr,
725  threeStr);
726 }
#define OT_ASSERT(x)
Definition: Assert.hpp:150
OTDB::Storage * s_pStorage
Definition: OTStorage.cpp:293
#define OT_ASSERT_MSG(x, s)
Definition: Assert.hpp:155
bool opentxs::OTDB::StoreString ( std::string  strContents,
std::string  strFolder,
std::string  oneStr = "",
std::string  twoStr = "",
std::string  threeStr = "" 
)

Definition at line 644 of file OTStorage.cpp.

646 {
647  {
648  OTString ot_strFolder(strFolder), ot_oneStr(oneStr), ot_twoStr(twoStr),
649  ot_threeStr(threeStr);
650  OT_ASSERT_MSG(ot_strFolder.Exists(),
651  "OTDB::StoreString: strFolder is null");
652 
653  if (!ot_oneStr.Exists()) {
654  OT_ASSERT_MSG((!ot_twoStr.Exists() && !ot_threeStr.Exists()),
655  "OTDB::StoreString: bad options");
656  oneStr = strFolder;
657  strFolder = ".";
658  }
659  }
660 
661  Storage* pStorage = details::s_pStorage;
662 
663  if (nullptr == pStorage) {
664  return false;
665  }
666 
667  return pStorage->StoreString(strContents, strFolder, oneStr, twoStr,
668  threeStr);
669 }
EXPORT bool StoreString(std::string strContents, std::string strFolder, std::string oneStr="", std::string twoStr="", std::string threeStr="")
Definition: OTStorage.cpp:2203
OTDB::Storage * s_pStorage
Definition: OTStorage.cpp:293
#define OT_ASSERT_MSG(x, s)
Definition: Assert.hpp:155

Variable Documentation

Storable& opentxs::OTDB::inObj = 0

Definition at line 376 of file OTStorage.hpp.

const char * opentxs::OTDB::StoredObjectTypeStrings
Initial value:
= {
"OTDBString",
"Blob",
"StringMap",
"WalletData",
"BitcoinAcct",
"BitcoinServer",
"RippleServer",
"LoomServer",
"ServerInfo",
"ContactNym",
"ContactAcct",
"Contact",
"AddressBook",
"MarketData",
"MarketList",
"BidData",
"AskData",
"OfferListMarket",
"TradeDataMarket",
"TradeListMarket",
"OfferDataNym",
"OfferListNym",
"TradeDataNym",
"TradeListNym",
"StoredObjError"
}

Definition at line 300 of file OTStorage.cpp.

InitOTDBDetails opentxs::OTDB::theOTDBConstructor

Definition at line 347 of file OTStorage.cpp.