Skip to content
This repository has been archived by the owner on Jul 3, 2023. It is now read-only.

Commit

Permalink
Updated version since chai to C++ rewrite. Also
Browse files Browse the repository at this point in the history
added a method to OTStorage.

Signed-off-by: FellowTraveler <F3llowTraveler@gmail.com>
  • Loading branch information
FellowTraveler authored and randy-waterhouse committed Apr 8, 2014
1 parent a96d48d commit c1721a2
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 6 deletions.
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
0.91.c
0.91.d
12 changes: 10 additions & 2 deletions include/otlib/OTStorage.hpp
Expand Up @@ -619,6 +619,10 @@ namespace OTDB
virtual bool Exists(std::string strFolder,
std::string oneStr="", std::string twoStr="", std::string threeStr="")=0;

virtual long FormPathString(std::string & strOutput,
std::string strFolder, std::string oneStr="",
std::string twoStr="", std::string threeStr="")=0;

// ********************************************************

virtual ~Storage() { if (NULL != m_pPacker) delete m_pPacker; m_pPacker = NULL; }
Expand Down Expand Up @@ -717,6 +721,9 @@ namespace OTDB
EXPORT bool Exists(std::string strFolder,
std::string oneStr="", std::string twoStr="", std::string threeStr="");

EXPORT long FormPathString(std::string & strOutput,
std::string strFolder, std::string oneStr="",
std::string twoStr="", std::string threeStr="");
// --------
// Store/Retrieve a string.
//
Expand Down Expand Up @@ -1580,8 +1587,9 @@ namespace OTDB
virtual bool Exists(std::string strFolder,
std::string oneStr="", std::string twoStr="", std::string threeStr="");

//virtual bool GetWalletFilePath(OTString & strWalletFilePath);

virtual long FormPathString(std::string & strOutput,
std::string strFolder, std::string oneStr="",
std::string twoStr="", std::string threeStr="");

// **********************************************************

Expand Down
4 changes: 2 additions & 2 deletions include/otlib/constants.h
Expand Up @@ -15,11 +15,11 @@

// Global
#ifndef OT_VERSION
#define OT_VERSION "0.91.c"
#define OT_VERSION "0.91.d"
#endif

#ifndef OT_PRODUCTVERSION
#define OT_PRODUCTVERSION 0,91,3,0
#define OT_PRODUCTVERSION 0,91,4,0
#endif

#ifndef OT_API_NAME
Expand Down
42 changes: 41 additions & 1 deletion src/otlib/OTStorage.cpp
Expand Up @@ -557,6 +557,37 @@ namespace OTDB
return pStorage->Exists(strFolder, oneStr, twoStr, threeStr);
}

long FormPathString(std::string & strOutput,
std::string strFolder, std::string oneStr/*=""*/,
std::string twoStr/*=""*/, std::string threeStr/*=""*/)
{
{
OTString ot_strFolder(strFolder),
ot_oneStr(oneStr),
ot_twoStr(twoStr),
ot_threeStr(threeStr);
OT_ASSERT_MSG(ot_strFolder.Exists(),"OTDB::FormPathString: strFolder is empty.");

if (!ot_oneStr.Exists())
{
OT_ASSERT_MSG((!ot_twoStr.Exists() && !ot_threeStr.Exists()),"FormPathString: bad options");
oneStr = strFolder;
strFolder = ".";
}
}
// ---------------------------------------------------
Storage * pStorage = details::s_pStorage;

if (NULL == pStorage)
{
OTLog::vOutput(0, "OTDB::%s: details::s_pStorage is null. (Returning -1.)\n",
__FUNCTION__);
return -1;
}

return pStorage->FormPathString(strOutput, strFolder, oneStr, twoStr, threeStr);
}

// -----------------------------------------
// Store/Retrieve a string.

Expand Down Expand Up @@ -3259,7 +3290,16 @@ namespace OTDB
return (0 < ConstructAndConfirmPath(strOutput, strFolder, oneStr, twoStr, threeStr));
}


// -----------------------------------------
// Returns path size, plus path in strOutput.
//
long StorageFS::FormPathString(std::string & strOutput,
std::string strFolder, std::string oneStr/*=""*/,
std::string twoStr/*=""*/, std::string threeStr/*=""*/)
{
return ConstructAndConfirmPath(strOutput, strFolder, oneStr, twoStr, threeStr);
}

// ********************************************************************


Expand Down

0 comments on commit c1721a2

Please sign in to comment.