Browse Source

Fix pfPython

Adam Johnson 10 years ago
parent
commit
eb68452554
  1. 12
      Sources/Plasma/FeatureLib/pfPython/cyAvatar.cpp
  2. 6
      Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp
  3. 32
      Sources/Plasma/FeatureLib/pfPython/pyAgeVault.cpp
  4. 15
      Sources/Plasma/FeatureLib/pfPython/pyDniInfoSource.cpp
  5. 10
      Sources/Plasma/FeatureLib/pfPython/pyDniInfoSource.h
  6. 2
      Sources/Plasma/FeatureLib/pfPython/pyDniInfoSourceGlue.cpp
  7. 34
      Sources/Plasma/FeatureLib/pfPython/pyVault.cpp
  8. 51
      Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNode.cpp
  9. 34
      Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNode.h
  10. 10
      Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNodeGlue.cpp
  11. 59
      Sources/Plasma/FeatureLib/pfPython/pyVaultChronicleNode.cpp
  12. 11
      Sources/Plasma/FeatureLib/pfPython/pyVaultChronicleNode.h
  13. 8
      Sources/Plasma/FeatureLib/pfPython/pyVaultChronicleNodeGlue.cpp
  14. 55
      Sources/Plasma/FeatureLib/pfPython/pyVaultFolderNode.cpp
  15. 10
      Sources/Plasma/FeatureLib/pfPython/pyVaultFolderNode.h
  16. 3
      Sources/Plasma/FeatureLib/pfPython/pyVaultFolderNodeGlue.cpp
  17. 35
      Sources/Plasma/FeatureLib/pfPython/pyVaultImageNode.cpp
  18. 5
      Sources/Plasma/FeatureLib/pfPython/pyVaultImageNode.h
  19. 4
      Sources/Plasma/FeatureLib/pfPython/pyVaultImageNodeGlue.cpp
  20. 14
      Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNode.cpp
  21. 10
      Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNode.h
  22. 2
      Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNodeGlue.cpp
  23. 35
      Sources/Plasma/FeatureLib/pfPython/pyVaultNode.cpp
  24. 1
      Sources/Plasma/FeatureLib/pfPython/pyVaultNode.h
  25. 68
      Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNode.cpp
  26. 13
      Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNode.h
  27. 4
      Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNodeGlue.cpp
  28. 32
      Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerNode.cpp
  29. 6
      Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerNode.h
  30. 11
      Sources/Plasma/FeatureLib/pfPython/pyVaultSDLNode.cpp
  31. 90
      Sources/Plasma/FeatureLib/pfPython/pyVaultTextNoteNode.cpp
  32. 9
      Sources/Plasma/FeatureLib/pfPython/pyVaultTextNoteNode.h
  33. 6
      Sources/Plasma/FeatureLib/pfPython/pyVaultTextNoteNodeGlue.cpp

12
Sources/Plasma/FeatureLib/pfPython/cyAvatar.cpp

@ -1665,15 +1665,12 @@ bool cyAvatar::LoadClothingFromFile(plFileName filename)
void cyAvatar::ChangeAvatar(const char* genderName)
{
#ifndef PLASMA_EXTERNAL_RELEASE
plClothingMgr::ChangeAvatar((char*)genderName);
wchar_t wStr[MAX_PATH];
StrToUnicode(wStr, genderName, arrsize(wStr));
plClothingMgr::ChangeAvatar(genderName);
hsRef<RelVaultNode> rvnPlr = VaultGetPlayerNode();
if (rvnPlr) {
VaultPlayerNode plr(rvnPlr);
plr.SetAvatarShapeName(wStr);
plr.SetAvatarShapeName(genderName);
}
#endif
}
@ -1687,13 +1684,10 @@ void cyAvatar::ChangeAvatar(const char* genderName)
//
void cyAvatar::ChangePlayerName(const char* playerName)
{
wchar_t wStr[MAX_PATH];
StrToUnicode(wStr, playerName, arrsize(wStr));
hsRef<RelVaultNode> rvnPlr = VaultGetPlayerNode();
if (rvnPlr) {
VaultPlayerNode plr(rvnPlr);
plr.SetPlayerName(wStr);
plr.SetPlayerName(playerName);
}
}

6
Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp

@ -2469,11 +2469,9 @@ int cyMisc::GetKILevel()
{
int result = pfKIMsg::kNanoKI;
wchar_t wStr[MAX_PATH];
StrToUnicode(wStr, pfKIMsg::kChronicleKILevel, arrsize(wStr));
if (hsRef<RelVaultNode> rvn = VaultFindChronicleEntry(wStr)) {
if (hsRef<RelVaultNode> rvn = VaultFindChronicleEntry(pfKIMsg::kChronicleKILevel)) {
VaultChronicleNode chron(rvn);
result = wcstol(chron.GetEntryValue(), nil, 0);
result = chron.GetEntryValue().ToInt();
}
return result;

32
Sources/Plasma/FeatureLib/pfPython/pyAgeVault.cpp

@ -203,10 +203,7 @@ void pyAgeVault::AddDevice( const char * deviceName, PyObject * cbObject, uint32
pyVaultNode::pyVaultNodeOperationCallback * cb = new pyVaultNode::pyVaultNodeOperationCallback( cbObject );
cb->VaultOperationStarted( cbContext );
wchar_t wStr[MAX_PATH];
StrToUnicode(wStr, deviceName, arrsize(wStr));
if (hsRef<RelVaultNode> rvn = VaultAgeAddDeviceAndWait(wStr))
if (hsRef<RelVaultNode> rvn = VaultAgeAddDeviceAndWait(deviceName))
cb->SetNode(rvn);
cb->VaultOperationComplete( cbContext, cb->GetNode() ? hsOK : hsFail); // cbHolder deletes itself here.
@ -215,27 +212,18 @@ void pyAgeVault::AddDevice( const char * deviceName, PyObject * cbObject, uint32
// Remove a device.
void pyAgeVault::RemoveDevice( const char * deviceName )
{
wchar_t wStr[MAX_PATH];
StrToUnicode(wStr, deviceName, arrsize(wStr));
VaultAgeRemoveDevice(wStr);
VaultAgeRemoveDevice(deviceName);
}
// True if device exists in age.
bool pyAgeVault::HasDevice( const char * deviceName )
{
wchar_t wStr[MAX_PATH];
StrToUnicode(wStr, deviceName, arrsize(wStr));
return VaultAgeHasDevice(wStr);
return VaultAgeHasDevice(deviceName);
}
PyObject * pyAgeVault::GetDevice( const char * deviceName )
{
wchar_t wStr[MAX_PATH];
StrToUnicode(wStr, deviceName, arrsize(wStr));
if (hsRef<RelVaultNode> rvn = VaultAgeGetDevice(wStr))
if (hsRef<RelVaultNode> rvn = VaultAgeGetDevice(deviceName))
return pyVaultTextNoteNode::New(rvn);
PYTHON_RETURN_NONE;
@ -247,12 +235,7 @@ void pyAgeVault::SetDeviceInbox( const char * deviceName, const char * inboxName
pyVaultNode::pyVaultNodeOperationCallback * cb = new pyVaultNode::pyVaultNodeOperationCallback( cbObject );
cb->VaultOperationStarted( cbContext );
wchar_t wDev[MAX_PATH];
StrToUnicode(wDev, deviceName, arrsize(wDev));
wchar_t wInb[MAX_PATH];
StrToUnicode(wInb, inboxName, arrsize(wInb));
if (hsRef<RelVaultNode> rvn = VaultAgeSetDeviceInboxAndWait(wDev, wInb))
if (hsRef<RelVaultNode> rvn = VaultAgeSetDeviceInboxAndWait(deviceName, inboxName))
cb->SetNode(rvn);
cb->VaultOperationComplete( cbContext, cb->GetNode() ? hsOK : hsFail ); // cbHolder deletes itself here.
@ -260,10 +243,7 @@ void pyAgeVault::SetDeviceInbox( const char * deviceName, const char * inboxName
PyObject * pyAgeVault::GetDeviceInbox( const char * deviceName )
{
wchar_t wStr[MAX_PATH];
StrToUnicode(wStr, deviceName, arrsize(wStr));
if (hsRef<RelVaultNode> rvn = VaultAgeGetDeviceInbox(wStr))
if (hsRef<RelVaultNode> rvn = VaultAgeGetDeviceInbox(deviceName))
return pyVaultTextNoteNode::New(rvn);
PYTHON_RETURN_NONE;

15
Sources/Plasma/FeatureLib/pfPython/pyDniInfoSource.cpp

@ -50,14 +50,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "plVault/plVault.h"
#include "pyDniCoordinates.h"
pyDniInfoSource::pyDniInfoSource()
: fAgeName(nil)
{}
pyDniInfoSource::~pyDniInfoSource() {
free(fAgeName);
}
PyObject* pyDniInfoSource::GetAgeCoords( void )
{
#if 0 // this may get retooled for another purpose someday...
@ -85,17 +77,14 @@ uint32_t pyDniInfoSource::GetAgeTime( void ) const
return result;
}
const char * pyDniInfoSource::GetAgeName( void ) const
plString pyDniInfoSource::GetAgeName() const
{
hsRef<RelVaultNode> node = VaultGetAgeInfoNode();
if (!node)
return "";
VaultAgeInfoNode ageInfo(node);
fAgeName = StrDupToAnsi(ageInfo.GetAgeInstanceName());
return fAgeName;
return ageInfo.GetAgeFilename();
}
plUUID pyDniInfoSource::GetAgeGuid( void ) const

10
Sources/Plasma/FeatureLib/pfPython/pyDniInfoSource.h

@ -46,18 +46,16 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "pyGlueHelpers.h"
class pyDniCoordinates;
class plString;
class plUUID;
class pyDniInfoSource
{
private:
mutable char * fAgeName;
protected:
pyDniInfoSource();
pyDniInfoSource() { }
public:
~pyDniInfoSource();
~pyDniInfoSource() { }
// required functions for PyObject interoperability
PYTHON_CLASS_NEW_FRIEND(ptDniInfoSource);
@ -72,7 +70,7 @@ public:
// current time in current age (tbd)
uint32_t GetAgeTime( void ) const;
// name of current age
const char * GetAgeName( void ) const;
plString GetAgeName() const;
// unique identifier for this age instance
plUUID GetAgeGuid(void) const;
};

2
Sources/Plasma/FeatureLib/pfPython/pyDniInfoSourceGlue.cpp

@ -69,7 +69,7 @@ PYTHON_METHOD_DEFINITION_NOARGS(ptDniInfoSource, getAgeTime)
PYTHON_METHOD_DEFINITION_NOARGS(ptDniInfoSource, getAgeName)
{
return PyString_FromString(self->fThis->GetAgeName());
return PyString_FromPlString(self->fThis->GetAgeName());
}
PYTHON_METHOD_DEFINITION_NOARGS(ptDniInfoSource, getAgeGuid)

34
Sources/Plasma/FeatureLib/pfPython/pyVault.cpp

@ -328,10 +328,7 @@ PyObject* pyVault::GetVisitAgeLink( const pyAgeInfoStruct & info)
// Chronicle
PyObject* pyVault::FindChronicleEntry( const char * entryName )
{
wchar_t wEntryName[kMaxVaultNodeStringLength];
StrToUnicode(wEntryName, entryName, arrsize(wEntryName));
if (hsRef<RelVaultNode> rvn = VaultFindChronicleEntry(wEntryName))
if (hsRef<RelVaultNode> rvn = VaultFindChronicleEntry(entryName))
return pyVaultChronicleNode::New(rvn);
// just return a None object
@ -340,16 +337,10 @@ PyObject* pyVault::FindChronicleEntry( const char * entryName )
void pyVault::AddChronicleEntry( const char * name, uint32_t type, const char * value )
{
wchar_t * wEntryName = StrDupToUnicode(name);
wchar_t * wEntryValue = StrDupToUnicode(value);
// FIXME: We should ideally not block, but for now, the Python assumes that when
// we return, the chronicle exists and can be found with findChronicleEntry.
// Maybe we should insert a dummy into the tree? (currently hard)
VaultAddChronicleEntryAndWait(wEntryName, type, wEntryValue);
free(wEntryName);
free(wEntryValue);
VaultAddChronicleEntryAndWait(name, type, value);
}
@ -358,11 +349,8 @@ void pyVault::SendToDevice( pyVaultNode& node, const char * deviceName )
if (!node.GetNode())
return;
wchar_t wDevName[256];
StrToUnicode(wDevName, deviceName, arrsize(wDevName));
// Note: This actually blocks (~Hoikas)
VaultPublishNode(node.GetNode()->GetNodeId(), wDevName);
VaultPublishNode(node.GetNode()->GetNodeId(), deviceName);
}
@ -412,16 +400,12 @@ PyObject* pyVault::GetPsnlAgeSDL() const
if (hsRef<RelVaultNode> rvnFldr = VaultGetAgesIOwnFolder()) {
templateNode->ClearFieldFlags();
templateNode->SetNodeType(plVault::kNodeType_AgeInfo);
VaultAgeInfoNode ageInfo(templateNode);
wchar_t str[MAX_PATH];
StrToUnicode(str, kPersonalAgeFilename, arrsize(str));
ageInfo.SetAgeFilename(str);
ageInfo.SetAgeFilename(kPersonalAgeFilename);
if (hsRef<RelVaultNode> rvnInfo = rvnFldr->GetChildNode(templateNode, 2)) {
templateNode->ClearFieldFlags();
templateNode->Clear();
templateNode->SetNodeType(plVault::kNodeType_SDL);
if (hsRef<RelVaultNode> rvnSdl = rvnInfo->GetChildNode(templateNode, 1)) {
@ -451,16 +435,12 @@ void pyVault::UpdatePsnlAgeSDL( pySDLStateDataRecord & pyrec )
if (hsRef<RelVaultNode> rvnFldr = VaultGetAgesIOwnFolder()) {
templateNode->ClearFieldFlags();
templateNode->SetNodeType(plVault::kNodeType_AgeInfo);
VaultAgeInfoNode ageInfo(templateNode);
wchar_t str[MAX_PATH];
StrToUnicode(str, kPersonalAgeFilename, arrsize(str));
ageInfo.SetAgeFilename(str);
ageInfo.SetAgeFilename(kPersonalAgeFilename);
if (hsRef<RelVaultNode> rvnInfo = rvnFldr->GetChildNode(templateNode, 2)) {
templateNode->ClearFieldFlags();
templateNode->Clear();
templateNode->SetNodeType(plVault::kNodeType_SDL);
if (hsRef<RelVaultNode> rvnSdl = rvnInfo->GetChildNode(templateNode, 1)) {

51
Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNode.cpp

@ -177,48 +177,42 @@ PyObject * pyVaultAgeInfoNode::GetParentAgeLink () const
}
const char * pyVaultAgeInfoNode::GetAgeFilename() const
plString pyVaultAgeInfoNode::GetAgeFilename() const
{
if (fNode) {
char str[MAX_PATH];
VaultAgeInfoNode access(fNode);
StrToAnsi(str, access.GetAgeFilename(), arrsize(str));
fAgeFilename = str;
return access.GetAgeFilename();
}
return fAgeFilename.c_str();
return "";
}
void pyVaultAgeInfoNode::SetAgeFilename( const char * v )
void pyVaultAgeInfoNode::SetAgeFilename(const plString& v)
{
}
const char * pyVaultAgeInfoNode::GetAgeInstanceName() const
plString pyVaultAgeInfoNode::GetAgeInstanceName() const
{
if (fNode) {
char str[MAX_PATH];
VaultAgeInfoNode access(fNode);
StrToAnsi(str, access.GetAgeInstanceName(), arrsize(str));
fAgeInstName = str;
return access.GetAgeInstanceName();
}
return fAgeInstName.c_str();
return "";
}
void pyVaultAgeInfoNode::SetAgeInstanceName( const char * v )
void pyVaultAgeInfoNode::SetAgeInstanceName(const plString& v)
{
}
const char * pyVaultAgeInfoNode::GetAgeUserDefinedName() const
plString pyVaultAgeInfoNode::GetAgeUserDefinedName() const
{
if (fNode) {
char str[MAX_PATH];
VaultAgeInfoNode access(fNode);
StrToAnsi(str, access.GetAgeUserDefinedName(), arrsize(str));
fAgeUserName = str;
return access.GetAgeUserDefinedName();
}
return fAgeUserName.c_str();
return "";
}
void pyVaultAgeInfoNode::SetAgeUserDefinedName( const char * v )
void pyVaultAgeInfoNode::SetAgeUserDefinedName(const plString& v)
{
}
@ -236,19 +230,16 @@ void pyVaultAgeInfoNode::SetAgeInstanceGuid( const char * sguid )
{
}
const char * pyVaultAgeInfoNode::GetAgeDescription() const
plString pyVaultAgeInfoNode::GetAgeDescription() const
{
if (fNode) {
char str[MAX_PATH];
memset(str, 0, sizeof(str));
VaultAgeInfoNode access(fNode);
StrToAnsi(str, access.GetAgeDescription(), arrsize(str));
fAgeDescription = str;
return access.GetAgeDescription();
}
return fAgeDescription.c_str();
return "";
}
void pyVaultAgeInfoNode::SetAgeDescription( const char * v )
void pyVaultAgeInfoNode::SetAgeDescription(const plString& v)
{
}
@ -303,18 +294,16 @@ bool pyVaultAgeInfoNode::IsPublic() const
return false;
}
const char * pyVaultAgeInfoNode::GetDisplayName() const
plString pyVaultAgeInfoNode::GetDisplayName() const
{
if (fNode) {
char str[MAX_PATH];
VaultAgeInfoNode access(fNode);
if (access.GetAgeSequenceNumber() > 0)
StrPrintf(str, arrsize(str), "%S(%d) %S", access.GetAgeUserDefinedName(), access.GetAgeSequenceNumber(), access.GetAgeInstanceName());
return plFormat("{}({}) {}", access.GetAgeUserDefinedName(), access.GetAgeSequenceNumber(), access.GetAgeInstanceName());
else
StrPrintf(str, arrsize(str), "%S %S", access.GetAgeUserDefinedName(), access.GetAgeInstanceName());
fAgeDispName = str;
return plFormat("{} {}", access.GetAgeUserDefinedName(), access.GetAgeInstanceName());
}
return fAgeDispName.c_str();
return "";
}
PyObject * pyVaultAgeInfoNode::AsAgeInfoStruct() const

34
Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNode.h

@ -96,35 +96,35 @@ public:
PyObject * GetParentAgeLink () const; // returns pyVaultAgeLinkNode, or None if not a child age.
const char * GetAgeFilename() const;
void SetAgeFilename( const char * v );
plString GetAgeFilename() const;
void SetAgeFilename(const plString& v);
const char * GetAgeInstanceName() const;
void SetAgeInstanceName( const char * v );
plString GetAgeInstanceName() const;
void SetAgeInstanceName(const plString& v);
const char * GetAgeUserDefinedName() const;
void SetAgeUserDefinedName( const char * v );
plString GetAgeUserDefinedName() const;
void SetAgeUserDefinedName(const plString& v);
plUUID GetAgeInstanceGuid() const;
void SetAgeInstanceGuid( const char * guid );
const char * GetAgeDescription() const;
void SetAgeDescription( const char * v );
plString GetAgeDescription() const;
void SetAgeDescription(const plString& v);
int32_t GetSequenceNumber() const;
void SetSequenceNumber( int32_t v );
int32_t GetSequenceNumber() const;
void SetSequenceNumber( int32_t v );
int32_t GetAgeLanguage() const;
void SetAgeLanguage( int32_t v );
int32_t GetAgeLanguage() const;
void SetAgeLanguage( int32_t v );
uint32_t GetAgeID() const;
void SetAgeID( uint32_t v );
uint32_t GetAgeID() const;
void SetAgeID( uint32_t v );
uint32_t GetCzarID() const;
uint32_t GetCzarID() const;
bool IsPublic() const;
bool IsPublic() const;
const char * GetDisplayName() const;
plString GetDisplayName() const;
PyObject * AsAgeInfoStruct() const; // returns pyAgeInfoStruct
};

10
Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNodeGlue.cpp

@ -97,7 +97,7 @@ PYTHON_METHOD_DEFINITION_NOARGS(ptVaultAgeInfoNode, getParentAgeLink)
PYTHON_METHOD_DEFINITION_NOARGS(ptVaultAgeInfoNode, getAgeFilename)
{
return PyString_FromString(self->fThis->GetAgeFilename());
return PyString_FromPlString(self->fThis->GetAgeFilename());
}
PYTHON_METHOD_DEFINITION(ptVaultAgeInfoNode, setAgeFilename, args)
@ -114,7 +114,7 @@ PYTHON_METHOD_DEFINITION(ptVaultAgeInfoNode, setAgeFilename, args)
PYTHON_METHOD_DEFINITION_NOARGS(ptVaultAgeInfoNode, getAgeInstanceName)
{
return PyString_FromString(self->fThis->GetAgeInstanceName());
return PyString_FromPlString(self->fThis->GetAgeInstanceName());
}
PYTHON_METHOD_DEFINITION(ptVaultAgeInfoNode, setAgeInstanceName, args)
@ -131,7 +131,7 @@ PYTHON_METHOD_DEFINITION(ptVaultAgeInfoNode, setAgeInstanceName, args)
PYTHON_METHOD_DEFINITION_NOARGS(ptVaultAgeInfoNode, getAgeUserDefinedName)
{
return PyString_FromString(self->fThis->GetAgeUserDefinedName());
return PyString_FromPlString(self->fThis->GetAgeUserDefinedName());
}
PYTHON_METHOD_DEFINITION(ptVaultAgeInfoNode, setAgeUserDefinedName, args)
@ -165,7 +165,7 @@ PYTHON_METHOD_DEFINITION(ptVaultAgeInfoNode, setAgeInstanceGuid, args)
PYTHON_METHOD_DEFINITION_NOARGS(ptVaultAgeInfoNode, getAgeDescription)
{
return PyString_FromString(self->fThis->GetAgeDescription());
return PyString_FromPlString(self->fThis->GetAgeDescription());
}
PYTHON_METHOD_DEFINITION(ptVaultAgeInfoNode, setAgeDescription, args)
@ -243,7 +243,7 @@ PYTHON_METHOD_DEFINITION_NOARGS(ptVaultAgeInfoNode, isPublic)
PYTHON_METHOD_DEFINITION_NOARGS(ptVaultAgeInfoNode, getDisplayName)
{
return PyString_FromString(self->fThis->GetDisplayName());
return PyString_FromPlString(self->fThis->GetDisplayName());
}
PYTHON_METHOD_DEFINITION_NOARGS(ptVaultAgeInfoNode, asAgeInfoStruct)

59
Sources/Plasma/FeatureLib/pfPython/pyVaultChronicleNode.cpp

@ -56,25 +56,16 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// should only be created from C++ side
pyVaultChronicleNode::pyVaultChronicleNode(RelVaultNode* nfsNode)
: pyVaultNode(nfsNode)
, ansiName(nil)
, ansiValue(nil)
{
}
//create from the Python side
pyVaultChronicleNode::pyVaultChronicleNode(int n)
: pyVaultNode(new RelVaultNode)
, ansiName(nil)
, ansiValue(nil)
{
fNode->SetNodeType(plVault::kNodeType_Chronicle);
}
pyVaultChronicleNode::~pyVaultChronicleNode () {
free(ansiName);
free(ansiValue);
}
//==================================================================
// class RelVaultNode : public plVaultNode
@ -84,50 +75,34 @@ void pyVaultChronicleNode::Chronicle_SetName( const char * text )
if (!fNode)
return;
wchar_t * wStr = StrDupToUnicode(text);
VaultChronicleNode chron(fNode);
chron.SetEntryName(wStr);
free(wStr);
chron.SetEntryName(text);
}
const char * pyVaultChronicleNode::Chronicle_GetName( void )
plString pyVaultChronicleNode::Chronicle_GetName() const
{
if (!fNode)
return "";
free(ansiName);
VaultChronicleNode chron(fNode);
ansiName = StrDupToAnsi(chron.GetEntryName());
return ansiName;
if (fNode) {
VaultChronicleNode chron(fNode);
return chron.GetEntryName();
}
return "";
}
void pyVaultChronicleNode::Chronicle_SetValue( const char * text )
{
if (!fNode)
return;
wchar_t * wStr = StrDupToUnicode(text);
VaultChronicleNode chron(fNode);
chron.SetEntryValue(wStr);
free(wStr);
if (fNode) {
VaultChronicleNode chron(fNode);
chron.SetEntryValue(text);
}
}
const char * pyVaultChronicleNode::Chronicle_GetValue( void )
plString pyVaultChronicleNode::Chronicle_GetValue() const
{
if (!fNode)
return "";
free(ansiValue);
ansiValue = nil;
VaultChronicleNode chron(fNode);
if (!chron.GetEntryValue())
return "";
ansiValue = StrDupToAnsi(chron.GetEntryValue());
return ansiValue;
if (fNode) {
VaultChronicleNode chron(fNode);
return chron.GetEntryValue();
}
return "";
}
void pyVaultChronicleNode::Chronicle_SetType( uint32_t type )

11
Sources/Plasma/FeatureLib/pfPython/pyVaultChronicleNode.h

@ -52,14 +52,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "pyGlueHelpers.h"
#include "pyVaultNode.h"
class plString;
struct RelVaultNode;
class pyVaultChronicleNode : public pyVaultNode
{
char * ansiName;
char * ansiValue;
protected:
// should only be created from C++ side
pyVaultChronicleNode(RelVaultNode* nfsNode);
@ -68,7 +65,7 @@ protected:
pyVaultChronicleNode(int n=0);
public:
~pyVaultChronicleNode ();
~pyVaultChronicleNode() { }
// required functions for PyObject interoperability
PYTHON_CLASS_NEW_FRIEND(ptVaultChronicleNode);
@ -83,9 +80,9 @@ public:
// class RelVaultNode : public plVaultNode
//
void Chronicle_SetName( const char * text );
const char * Chronicle_GetName( void );
plString Chronicle_GetName() const;
void Chronicle_SetValue( const char * text );
const char * Chronicle_GetValue( void );
plString Chronicle_GetValue() const;
void Chronicle_SetType( uint32_t type );
uint32_t Chronicle_GetType( void );
};

8
Sources/Plasma/FeatureLib/pfPython/pyVaultChronicleNodeGlue.cpp

@ -78,7 +78,7 @@ PYTHON_METHOD_DEFINITION(ptVaultChronicleNode, chronicleSetName, args)
PYTHON_METHOD_DEFINITION_NOARGS(ptVaultChronicleNode, chronicleGetName)
{
return PyString_FromString(self->fThis->Chronicle_GetName());
return PyString_FromPlString(self->fThis->Chronicle_GetName());
}
PYTHON_METHOD_DEFINITION(ptVaultChronicleNode, chronicleSetValue, args)
@ -95,7 +95,7 @@ PYTHON_METHOD_DEFINITION(ptVaultChronicleNode, chronicleSetValue, args)
PYTHON_METHOD_DEFINITION_NOARGS(ptVaultChronicleNode, chronicleGetValue)
{
return PyString_FromString(self->fThis->Chronicle_GetValue());
return PyString_FromPlString(self->fThis->Chronicle_GetValue());
}
PYTHON_METHOD_DEFINITION(ptVaultChronicleNode, chronicleSetType, args)
@ -129,7 +129,7 @@ PYTHON_METHOD_DEFINITION(ptVaultChronicleNode, setName, args)
PYTHON_METHOD_DEFINITION_NOARGS(ptVaultChronicleNode, getName)
{
return PyString_FromString(self->fThis->Chronicle_GetName());
return PyString_FromPlString(self->fThis->Chronicle_GetName());
}
PYTHON_METHOD_DEFINITION(ptVaultChronicleNode, setValue, args)
@ -146,7 +146,7 @@ PYTHON_METHOD_DEFINITION(ptVaultChronicleNode, setValue, args)
PYTHON_METHOD_DEFINITION_NOARGS(ptVaultChronicleNode, getValue)
{
return PyString_FromString(self->fThis->Chronicle_GetValue());
return PyString_FromPlString(self->fThis->Chronicle_GetValue());
}
PYTHON_METHOD_DEFINITION(ptVaultChronicleNode, setEntryType, args)

55
Sources/Plasma/FeatureLib/pfPython/pyVaultFolderNode.cpp

@ -87,50 +87,27 @@ int pyVaultFolderNode::Folder_GetType( void )
return folder.GetFolderType();
}
void pyVaultFolderNode::Folder_SetName( std::string name )
void pyVaultFolderNode::Folder_SetName(const char* name)
{
if (!fNode)
return;
wchar_t* wName = hsStringToWString(name.c_str());
VaultFolderNode folder(fNode);
folder.SetFolderName(wName);
delete [] wName;
}
void pyVaultFolderNode::Folder_SetNameW( std::wstring name )
{
if (!fNode)
return;
VaultFolderNode folder(fNode);
folder.SetFolderName(name.c_str());
if (fNode) {
VaultFolderNode folder(fNode);
folder.SetFolderName(name);
}
}
std::string pyVaultFolderNode::Folder_GetName( void )
void pyVaultFolderNode::Folder_SetNameW(const wchar_t* name)
{
if (!fNode)
return "";
VaultFolderNode folder(fNode);
if (!folder.GetFolderName())
return "";
std::string retVal;
char* sName = hsWStringToString(folder.GetFolderName());
retVal = sName;
delete [] sName;
return retVal;
if (fNode) {
VaultFolderNode folder(fNode);
folder.SetFolderName(plString::FromWchar(name));
}
}
std::wstring pyVaultFolderNode::Folder_GetNameW( void )
plString pyVaultFolderNode::Folder_GetName() const
{
if (!fNode)
return L"";
VaultFolderNode folder(fNode);
if (!folder.GetFolderName())
return L"";
return folder.GetFolderName();
if (fNode) {
VaultFolderNode folder(fNode);
return folder.GetFolderName();
}
return "";
}

10
Sources/Plasma/FeatureLib/pfPython/pyVaultFolderNode.h

@ -50,12 +50,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "HeadSpin.h"
#include "pyGlueHelpers.h"
#include <string>
#include "pyVaultNode.h"
class plString;
struct RelVaultNode;
class pyVaultFolderNode : public pyVaultNode
{
protected:
@ -80,10 +79,9 @@ public:
virtual void Folder_SetType( int type );
virtual int Folder_GetType( void );
void Folder_SetName( std::string name );
void Folder_SetNameW( std::wstring name );
std::string Folder_GetName( void );
std::wstring Folder_GetNameW( void );
void Folder_SetName(const char* name);
void Folder_SetNameW(const wchar_t* name);
plString Folder_GetName() const;

3
Sources/Plasma/FeatureLib/pfPython/pyVaultFolderNodeGlue.cpp

@ -164,8 +164,7 @@ PYTHON_METHOD_DEFINITION_NOARGS(ptVaultFolderNode, getFolderName)
PYTHON_METHOD_DEFINITION_NOARGS(ptVaultFolderNode, getFolderNameW)
{
std::wstring name = self->fThis->Folder_GetNameW();
return PyUnicode_FromWideChar(name.c_str(), name.length());
return PyUnicode_FromStringEx(self->fThis->Folder_GetName());
}
PYTHON_START_METHODS_TABLE(ptVaultFolderNode)

35
Sources/Plasma/FeatureLib/pfPython/pyVaultImageNode.cpp

@ -117,11 +117,8 @@ void pyVaultImageNode::Image_SetTitle( const char * text )
if (!fNode)
return;
wchar_t * wStr = hsStringToWString(text);
VaultImageNode image(fNode);
image.SetImageTitle(wStr);
delete [] wStr;
image.SetImageTitle(text);
}
void pyVaultImageNode::Image_SetTitleW( const wchar_t* text )
@ -130,34 +127,16 @@ void pyVaultImageNode::Image_SetTitleW( const wchar_t* text )
return;
VaultImageNode image(fNode);
image.SetImageTitle(text);
image.SetImageTitle(plString::FromWchar(text));
}
std::string pyVaultImageNode::Image_GetTitle( void )
plString pyVaultImageNode::Image_GetTitle() const
{
if (!fNode)
return "";
VaultImageNode image(fNode);
std::string retVal = "";
if (image.GetImageTitle())
{
char* temp = hsWStringToString(image.GetImageTitle());
retVal = temp;
delete [] temp;
if (fNode) {
VaultImageNode image(fNode);
return image.GetImageTitle();
}
return retVal;
}
std::wstring pyVaultImageNode::Image_GetTitleW( void )
{
if (!fNode)
return L"";
VaultImageNode image(fNode);
return image.GetImageTitle() ? image.GetImageTitle() : L"";
return "";
}
PyObject* pyVaultImageNode::Image_GetImage( void )

5
Sources/Plasma/FeatureLib/pfPython/pyVaultImageNode.h

@ -51,12 +51,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "HeadSpin.h"
#include "pyGlueHelpers.h"
#include "pnKeyedObject/plKey.h"
#include <string>
#include "pyVaultNode.h"
struct RelVaultNode;
class plMipmap;
class plString;
class pyVaultImageNode : public pyVaultNode
{
@ -88,8 +88,7 @@ public:
//
void Image_SetTitle( const char * text );
void Image_SetTitleW( const wchar_t * text );
std::string Image_GetTitle( void );
std::wstring Image_GetTitleW( void );
plString Image_GetTitle() const;
PyObject* Image_GetImage( void ); // returns pyImage
void Image_SetImage(pyImage& image);

4
Sources/Plasma/FeatureLib/pfPython/pyVaultImageNodeGlue.cpp

@ -154,8 +154,8 @@ PYTHON_METHOD_DEFINITION_NOARGS(ptVaultImageNode, getTitle)
PYTHON_METHOD_DEFINITION_NOARGS(ptVaultImageNode, getTitleW)
{
std::wstring retVal = self->fThis->Image_GetTitleW();
return PyUnicode_FromWideChar(retVal.c_str(), retVal.length());
plStringBuffer<wchar_t> retVal = self->fThis->Image_GetTitle().ToWchar();
return PyUnicode_FromWideChar(retVal.GetData(), retVal.GetSize());
}
PYTHON_METHOD_DEFINITION(ptVaultImageNode, setImage, args)

14
Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNode.cpp

@ -68,24 +68,20 @@ pyVaultMarkerGameNode::pyVaultMarkerGameNode(int n)
// class RelVaultNode : public plVaultNode
//
const char * pyVaultMarkerGameNode::GetGameName () const
plString pyVaultMarkerGameNode::GetGameName () const
{
fGameName[0] = 0;
if (fNode) {
VaultMarkerGameNode access(fNode);
StrToAnsi(fGameName, access.GetGameName(), arrsize(fGameName));
return access.GetGameName();
}
return fGameName;
return "";
}
void pyVaultMarkerGameNode::SetGameName (const char v[])
void pyVaultMarkerGameNode::SetGameName (const plString& name)
{
if (fNode) {
VaultMarkerGameNode access(fNode);
wchar_t unicode[kMaxVaultNodeStringLength];
StrToUnicode(unicode, v, arrsize(unicode));
access.SetGameName(unicode);
access.SetGameName(name);
}
}

10
Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNode.h

@ -53,16 +53,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "pyGlueHelpers.h"
#include "pyVaultNode.h"
#include "pnNetBase/pnNetBase.h"
class plString;
struct RelVaultNode;
class plUUID;
class pyVaultMarkerGameNode : public pyVaultNode
{
private:
mutable char fGameName[kMaxVaultNodeStringLength];
protected:
// should only be created from C++ side
pyVaultMarkerGameNode(RelVaultNode* vaultNode);
@ -83,8 +79,8 @@ public:
//==================================================================
// class RelVaultNode : public plVaultNode
//
const char * GetGameName () const;
void SetGameName (const char v[]);
plString GetGameName () const;
void SetGameName (const plString& name);
plUUID GetGameGuid() const;
void SetGameGuid (const char v[]);

2
Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNodeGlue.cpp

@ -67,7 +67,7 @@ PYTHON_INIT_DEFINITION(ptVaultMarkerGameNode, args, keywords)
PYTHON_METHOD_DEFINITION_NOARGS(ptVaultMarkerGameNode, getGameName)
{
return PyString_FromString(self->fThis->GetGameName());
return PyString_FromPlString(self->fThis->GetGameName());
}
PYTHON_METHOD_DEFINITION(ptVaultMarkerGameNode, setGameName, args)

35
Sources/Plasma/FeatureLib/pfPython/pyVaultNode.cpp

@ -164,23 +164,17 @@ hsRef<RelVaultNode> pyVaultNode::pyVaultNodeOperationCallback::GetNode() const {
return fNode;
}
// only for python glue, do NOT call
pyVaultNode::pyVaultNode()
: fCreateAgeName(nil)
{
}
// should only be created from C++ side
pyVaultNode::pyVaultNode( RelVaultNode* nfsNode )
: fNode(nfsNode)
, fCreateAgeName(nil)
{
}
pyVaultNode::~pyVaultNode()
{
free(fCreateAgeName);
}
pyVaultNode::~pyVaultNode() {}
hsRef<RelVaultNode> pyVaultNode::GetNode() const
@ -291,22 +285,11 @@ uint32_t pyVaultNode::GetCreateAgeTime( void )
return GetCreateTime();
}
const char * pyVaultNode::GetCreateAgeName( void )
const char * pyVaultNode::GetCreateAgeName()
{
if (!fNode)
return "";
if (fCreateAgeName)
return fCreateAgeName;
if (fNode) {
if (fNode->GetCreateAgeName())
fCreateAgeName = StrDupToAnsi(fNode->GetCreateAgeName());
else
fCreateAgeName = StrDup("");
}
return fCreateAgeName;
if (fNode)
return fNode->GetCreateAgeName().c_str();
return "";
}
plUUID pyVaultNode::GetCreateAgeGuid(void) const
@ -359,13 +342,7 @@ void pyVaultNode::SetCreatorNodeID( uint32_t v )
void pyVaultNode::SetCreateAgeName( const char * v )
{
free(fCreateAgeName);
fCreateAgeName = nil;
ASSERT(fNode);
wchar_t str[MAX_PATH];
StrToUnicode(str, v, arrsize(str));
fNode->SetCreateAgeName(str);
fNode->SetCreateAgeName(v);
}
void pyVaultNode::SetCreateAgeGuid( const char * v )

1
Sources/Plasma/FeatureLib/pfPython/pyVaultNode.h

@ -99,7 +99,6 @@ public:
};
hsRef<RelVaultNode> fNode;
mutable char * fCreateAgeName;
protected:
// only for python glue, do NOT call

68
Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNode.cpp

@ -57,24 +57,16 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// should only be created from C++ side
pyVaultPlayerInfoNode::pyVaultPlayerInfoNode(RelVaultNode* nfsNode)
: pyVaultNode(nfsNode)
, ansiPlayerName(nil)
, ansiAgeInstName(nil)
{
}
//create from the Python side
pyVaultPlayerInfoNode::pyVaultPlayerInfoNode()
: pyVaultNode(new RelVaultNode)
, ansiPlayerName(nil)
, ansiAgeInstName(nil)
{
fNode->SetNodeType(plVault::kNodeType_PlayerInfo);
}
pyVaultPlayerInfoNode::~pyVaultPlayerInfoNode () {
free(ansiPlayerName);
free(ansiAgeInstName);
}
//==================================================================
// class RelVaultNode : public plVaultNode
@ -97,55 +89,39 @@ uint32_t pyVaultPlayerInfoNode::Player_GetPlayerID( void )
return playerInfo.GetPlayerId();
}
void pyVaultPlayerInfoNode::Player_SetPlayerName( const char * name )
void pyVaultPlayerInfoNode::Player_SetPlayerName(const plString& name)
{
if (!fNode)
return;
wchar_t * wStr = StrDupToUnicode(name);
VaultPlayerInfoNode playerInfo(fNode);
playerInfo.SetPlayerName(wStr);
free(wStr);
if (fNode) {
VaultPlayerInfoNode playerInfo(fNode);
playerInfo.SetPlayerName(name);
}
}
const char * pyVaultPlayerInfoNode::Player_GetPlayerName( void )
plString pyVaultPlayerInfoNode::Player_GetPlayerName() const
{
if (!fNode)
return "";
VaultPlayerInfoNode playerInfo(fNode);
if (!playerInfo.GetPlayerName())
return "";
free(ansiPlayerName);
ansiPlayerName = StrDupToAnsi(playerInfo.GetPlayerName());
return ansiPlayerName;
if (fNode) {
VaultPlayerInfoNode playerInfo(fNode);
return playerInfo.GetPlayerName();
}
return "";
}
// age the player is currently in, if any.
void pyVaultPlayerInfoNode::Player_SetAgeInstanceName( const char * agename )
void pyVaultPlayerInfoNode::Player_SetAgeInstanceName(const plString& name)
{
if (!fNode)
return;
wchar_t * wStr = StrDupToUnicode(agename);
VaultPlayerInfoNode playerInfo(fNode);
playerInfo.SetAgeInstName(wStr);
free(wStr);
if (fNode) {
VaultPlayerInfoNode playerInfo(fNode);
playerInfo.SetAgeInstName(name);
}
}
const char * pyVaultPlayerInfoNode::Player_GetAgeInstanceName( void )
plString pyVaultPlayerInfoNode::Player_GetAgeInstanceName() const
{
if (!fNode)
return "";
VaultPlayerInfoNode playerInfo(fNode);
if (!playerInfo.GetAgeInstName())
return "";
free(ansiAgeInstName);
ansiAgeInstName = StrDupToAnsi(playerInfo.GetAgeInstName());
return ansiAgeInstName;
if (fNode) {
VaultPlayerInfoNode playerInfo(fNode);
return playerInfo.GetAgeInstName();
}
return "";
}
void pyVaultPlayerInfoNode::Player_SetAgeGuid( const char * guidtext)

13
Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNode.h

@ -55,9 +55,6 @@ class plUUID;
class pyVaultPlayerInfoNode : public pyVaultNode
{
mutable char * ansiPlayerName;
mutable char * ansiAgeInstName;
protected:
// should only be created from C++ side
pyVaultPlayerInfoNode(RelVaultNode * node);
@ -66,7 +63,7 @@ protected:
pyVaultPlayerInfoNode();
public:
~pyVaultPlayerInfoNode ();
~pyVaultPlayerInfoNode() { }
// required functions for PyObject interoperability
PYTHON_CLASS_NEW_FRIEND(ptVaultPlayerInfoNode);
@ -82,12 +79,12 @@ public:
//
void Player_SetPlayerID( uint32_t plyrid );
uint32_t Player_GetPlayerID( void );
void Player_SetPlayerName( const char * name );
const char * Player_GetPlayerName( void );
void Player_SetPlayerName(const plString& name);
plString Player_GetPlayerName() const;
// age the player is currently in, if any.
void Player_SetAgeInstanceName( const char * agename );
const char * Player_GetAgeInstanceName( void );
void Player_SetAgeInstanceName(const plString& name);
plString Player_GetAgeInstanceName() const;
void Player_SetAgeGuid( const char * guidtext);
plUUID Player_GetAgeGuid(void) const;
// online status

4
Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNodeGlue.cpp

@ -89,7 +89,7 @@ PYTHON_METHOD_DEFINITION(ptVaultPlayerInfoNode, playerSetName, args)
PYTHON_METHOD_DEFINITION_NOARGS(ptVaultPlayerInfoNode, playerGetName)
{
return PyString_FromString(self->fThis->Player_GetPlayerName());
return PyString_FromPlString(self->fThis->Player_GetPlayerName());
}
PYTHON_METHOD_DEFINITION(ptVaultPlayerInfoNode, playerSetAgeInstanceName, args)
@ -106,7 +106,7 @@ PYTHON_METHOD_DEFINITION(ptVaultPlayerInfoNode, playerSetAgeInstanceName, args)
PYTHON_METHOD_DEFINITION_NOARGS(ptVaultPlayerInfoNode, playerGetAgeInstanceName)
{
return PyString_FromString(self->fThis->Player_GetAgeInstanceName());
return PyString_FromPlString(self->fThis->Player_GetAgeInstanceName());
}
PYTHON_METHOD_DEFINITION(ptVaultPlayerInfoNode, playerSetAgeGuid, args)

32
Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerNode.cpp

@ -231,9 +231,7 @@ void pyVaultPlayerNode::RemoveVisitAgeLink(const char *guidstr)
PyObject *pyVaultPlayerNode::FindChronicleEntry(const char *entryName)
{
wchar_t wStr[MAX_PATH];
StrToUnicode(wStr, entryName, arrsize(wStr));
if (hsRef<RelVaultNode> rvn = VaultFindChronicleEntry(wStr))
if (hsRef<RelVaultNode> rvn = VaultFindChronicleEntry(entryName))
return pyVaultChronicleNode::New(rvn);
PYTHON_RETURN_NONE;
@ -244,15 +242,13 @@ void pyVaultPlayerNode::SetPlayerName(const char *value)
hsAssert(false, "python may not change a player's name this way");
}
std::string pyVaultPlayerNode::GetPlayerName()
plString pyVaultPlayerNode::GetPlayerName() const
{
if (!fNode)
return "";
VaultPlayerNode player(fNode);
char ansiStr[MAX_PATH];
StrToAnsi(ansiStr, player.GetPlayerName(), arrsize(ansiStr));
return ansiStr;
if (fNode) {
VaultPlayerNode player(fNode);
return player.GetPlayerName();
}
return "";
}
void pyVaultPlayerNode::SetAvatarShapeName(const char *value)
@ -260,15 +256,13 @@ void pyVaultPlayerNode::SetAvatarShapeName(const char *value)
hsAssert(false, "python may not change a player's avatar this way");
}
std::string pyVaultPlayerNode::GetAvatarShapeName()
plString pyVaultPlayerNode::GetAvatarShapeName() const
{
if (!fNode)
return "";
VaultPlayerNode player(fNode);
char ansiStr[MAX_PATH];
StrToAnsi(ansiStr, player.GetAvatarShapeName(), arrsize(ansiStr));
return ansiStr;
if (fNode) {
VaultPlayerNode player(fNode);
return player.GetAvatarShapeName();
}
return "";
}
void pyVaultPlayerNode::SetDisabled(bool value)

6
Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerNode.h

@ -49,10 +49,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
//////////////////////////////////////////////////////////////////////
#include "HeadSpin.h"
#include "pyGlueHelpers.h"
#include <string>
#include "pyVaultNode.h"
class pyAgeInfoStruct;
class plString;
struct RelVaultNode;
class pyVaultPlayerNode : public pyVaultNode
@ -101,10 +101,10 @@ public:
PyObject *FindChronicleEntry(const char *entryName); // returns pyVaultChronicleNode
void SetPlayerName(const char *value);
std::string GetPlayerName();
plString GetPlayerName() const;
void SetAvatarShapeName(const char *value);
std::string GetAvatarShapeName();
plString GetAvatarShapeName() const;
void SetDisabled(bool value);
bool IsDisabled();

11
Sources/Plasma/FeatureLib/pfPython/pyVaultSDLNode.cpp

@ -105,13 +105,10 @@ PyObject * pyVaultSDLNode::GetStateDataRecord() const
void pyVaultSDLNode::InitStateDataRecord( const char* agename, int flags)
{
if (!fNode)
return;
wchar_t wStr[MAX_PATH];
StrToUnicode(wStr, agename, arrsize(wStr));
VaultSDLNode sdl(fNode);
sdl.InitStateDataRecord(wStr, flags);
if (fNode) {
VaultSDLNode sdl(fNode);
sdl.InitStateDataRecord(agename, flags);
}
}
void pyVaultSDLNode::SetStateDataRecord( const pySDLStateDataRecord & rec, int writeOptions/*=0 */)

90
Sources/Plasma/FeatureLib/pfPython/pyVaultTextNoteNode.cpp

@ -75,14 +75,10 @@ pyVaultTextNoteNode::pyVaultTextNoteNode()
//
void pyVaultTextNoteNode::Note_SetTitle( const char * text )
{
if (!fNode)
return;
wchar_t wStr[MAX_PATH] = L"";
if (text)
StrToUnicode(wStr, text, arrsize(wStr));
VaultTextNoteNode textNote(fNode);
textNote.SetNoteTitle(wStr);
if (fNode) {
VaultTextNoteNode textNote(fNode);
textNote.SetNoteTitle(text);
}
}
void pyVaultTextNoteNode::Note_SetTitleW( const wchar_t * text )
@ -91,48 +87,24 @@ void pyVaultTextNoteNode::Note_SetTitleW( const wchar_t * text )
return;
VaultTextNoteNode textNote(fNode);
textNote.SetNoteTitle(text);
textNote.SetNoteTitle(plString::FromWchar(text));
}
std::string pyVaultTextNoteNode::Note_GetTitle( void )
plString pyVaultTextNoteNode::Note_GetTitle() const
{
if (!fNode)
return "";
char * aStr = nil;
VaultTextNoteNode textNote(fNode);
if (textNote.GetNoteTitle()) {
std::string result;
aStr = StrDupToAnsi(textNote.GetNoteTitle());
result = aStr;
free(aStr);
return result;
if (fNode) {
VaultTextNoteNode note(fNode);
return note.GetNoteTitle();
}
return "";
}
std::wstring pyVaultTextNoteNode::Note_GetTitleW( void )
void pyVaultTextNoteNode::Note_SetText(const char * text)
{
if (!fNode)
return L"";
VaultTextNoteNode textNote(fNode);
if (textNote.GetNoteTitle())
return textNote.GetNoteTitle();
return L"";
}
void pyVaultTextNoteNode::Note_SetText( const char * text )
{
if (!fNode)
return;
wchar_t * wStr = nil;
if (text)
wStr = StrDupToUnicode(text);
VaultTextNoteNode textNote(fNode);
textNote.SetNoteText(wStr);
free(wStr);
if (fNode) {
VaultTextNoteNode textNote(fNode);
textNote.SetNoteText(text);
}
}
void pyVaultTextNoteNode::Note_SetTextW( const wchar_t * text )
@ -141,37 +113,18 @@ void pyVaultTextNoteNode::Note_SetTextW( const wchar_t * text )
return;
VaultTextNoteNode textNote(fNode);
textNote.SetNoteText(text);
textNote.SetNoteText(plString::FromWchar(text));
}
std::string pyVaultTextNoteNode::Note_GetText( void )
plString pyVaultTextNoteNode::Note_GetText() const
{
if (!fNode)
return "";
char * aStr = nil;
VaultTextNoteNode textNote(fNode);
if (textNote.GetNoteText()) {
std::string result;
aStr = StrDupToAnsi(textNote.GetNoteText());
result = aStr;
free(aStr);
return result;
if (fNode) {
VaultTextNoteNode note(fNode);
return note.GetNoteText();
}
return "";
}
std::wstring pyVaultTextNoteNode::Note_GetTextW( void )
{
if (!fNode)
return L"";
VaultTextNoteNode textNote(fNode);
if (textNote.GetNoteText())
return textNote.GetNoteText();
return L"";
}
void pyVaultTextNoteNode::Note_SetType( int32_t type )
{
if (!fNode)
@ -225,10 +178,7 @@ void pyVaultTextNoteNode::SetDeviceInbox( const char * devName, PyObject * cbObj
pyVaultNode::pyVaultNodeOperationCallback * cb = new pyVaultNode::pyVaultNodeOperationCallback( cbObject );
cb->VaultOperationStarted( cbContext );
wchar_t wDev[MAX_PATH];
StrToUnicode(wDev, devName, arrsize(wDev));
if (hsRef<RelVaultNode> rvn = VaultAgeSetDeviceInboxAndWait(wDev, DEFAULT_DEVICE_INBOX))
if (hsRef<RelVaultNode> rvn = VaultAgeSetDeviceInboxAndWait(devName, DEFAULT_DEVICE_INBOX))
cb->SetNode(rvn);
cb->VaultOperationComplete( cbContext, cb->GetNode() ? hsOK : hsFail ); // cbHolder deletes itself here.

9
Sources/Plasma/FeatureLib/pfPython/pyVaultTextNoteNode.h

@ -50,13 +50,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "HeadSpin.h"
#include "pyGlueHelpers.h"
#include <string>
#include "pyVaultNode.h"
class plString;
struct RelVaultNode;
class pyVaultAgeLinkNode;
class pyVaultTextNoteNode : public pyVaultNode
{
protected:
@ -82,12 +81,10 @@ public:
//
void Note_SetTitle( const char * text );
void Note_SetTitleW( const wchar_t * text );
std::string Note_GetTitle( void );
std::wstring Note_GetTitleW( void );
plString Note_GetTitle() const;
void Note_SetText( const char * text );
void Note_SetTextW( const wchar_t * text );
std::string Note_GetText( void );
std::wstring Note_GetTextW( void );
plString Note_GetText() const;
void Note_SetType( int32_t type );
int32_t Note_GetType( void );

6
Sources/Plasma/FeatureLib/pfPython/pyVaultTextNoteNodeGlue.cpp

@ -173,8 +173,7 @@ PYTHON_METHOD_DEFINITION_NOARGS(ptVaultTextNoteNode, getTitle)
PYTHON_METHOD_DEFINITION_NOARGS(ptVaultTextNoteNode, getTitleW)
{
std::wstring retVal = self->fThis->Note_GetTitleW();
return PyUnicode_FromWideChar(retVal.c_str(), retVal.length());
return PyUnicode_FromStringEx(self->fThis->Note_GetTitle());
}
PYTHON_METHOD_DEFINITION(ptVaultTextNoteNode, setText, args)
@ -225,8 +224,7 @@ PYTHON_METHOD_DEFINITION_NOARGS(ptVaultTextNoteNode, getText)
PYTHON_METHOD_DEFINITION_NOARGS(ptVaultTextNoteNode, getTextW)
{
std::wstring retVal = self->fThis->Note_GetTextW();
return PyUnicode_FromWideChar(retVal.c_str(), retVal.length());
return PyUnicode_FromStringEx(self->fThis->Note_GetText());
}
PYTHON_METHOD_DEFINITION(ptVaultTextNoteNode, setType, args)

Loading…
Cancel
Save