15#ifndef WSFPPROXYUNDO_HPP
16#define WSFPPROXYUNDO_HPP
18#include "wsf_parser_export.h"
23#include "UtReferenceCount.hpp"
46class WsfPProxyUndo_ActionAssign;
47class WsfPProxyUndo_ActionMapOp;
48class WsfPProxyUndo_ActionListOp;
77 void Rollback(
size_t aHistoryIndex);
78 void Commit(
size_t aHistoryIndex = 0);
81 bool MapDelete(
const WsfPProxyPath& aMapPath,
const std::string& aMapKey);
86 bool SetUnset(
const WsfPProxyPath& aAttributePath,
bool aIsUnset =
true);
92 void PushAction(std::unique_ptr<ActionBase> aAction);
94 std::vector<std::unique_ptr<ActionBase>> mActions;
196 for (
size_t i = 0; i < aPath.
size(); ++i)
209 for (
size_t i = 0; i < aLookupPath.size() &&
ok; ++i)
211 const std::string& addr = aLookupPath[i].Get();
281 assert(!
"INVALID INDEX");
290 operator bool()
const {
return mUndoPtr !=
nullptr; }
291 std::string DebugAddr()
const;
@ cMDB_PARSE_UNDO
Definition WsfParseDebugMarkers.hpp:31
std::vector< UtStringRef > WsfParseTypePath
Definition WsfParseTypePath.hpp:21
bool ok
Definition WsfScriptWeaponClass.cpp:211
Definition WsfPProxyUndo.hpp:30
virtual ~WsfPProxyDeserializeObserver()
Definition WsfPProxyUndo.hpp:32
virtual void BeforeAssignment(const WsfPProxyPath &aPath, WsfPProxyValue &aNewValue)=0
virtual void BeforeListPush(const WsfPProxyPath &aListPath)=0
virtual void AfterLoad(const WsfPProxyPath &aLoadPath)=0
virtual void BeforeMapInsert(const WsfPProxyPath &aMapPath, const std::string &aMapKey, WsfPProxyValue aValue)=0
virtual void BeforeCopy(const WsfPProxyPath &aCopyFrom)=0
virtual void BeforeMapDelete(const WsfPProxyPath &aMapPath, const std::string &aMapKey)=0
Definition WsfPProxyKey.hpp:24
size_t GetIndex() const
Definition WsfPProxyKey.hpp:42
const std::string & GetMapKey() const
Definition WsfPProxyKey.hpp:43
bool IsString() const
Definition WsfPProxyKey.cpp:47
Represents a path or unique key to a value in the proxy.
Definition WsfPProxyPath.hpp:64
size_t size() const
Definition WsfPProxyPath.hpp:142
WsfPProxyUndoValue GetParent() const
Definition WsfPProxyUndo.hpp:247
bool SetUnset(bool aIsUnset)
Definition WsfPProxyUndo.hpp:227
bool MoveToAttr(const std::string &aKey)
Definition WsfPProxyUndo.hpp:174
void MoveToParent()
Definition WsfPProxyUndo.hpp:246
WsfPProxyUndoValue GetAttr(const WsfParseTypePath &aLookupPath) const
Definition WsfPProxyUndo.hpp:217
UtReferenceCount * mReferenceCount
Definition WsfPProxyUndo.hpp:313
WsfPProxyUndoValue GetAttr(size_t aIndex) const
Definition WsfPProxyUndo.hpp:234
void Cleanup()
Definition WsfPProxyUndo.hpp:298
void Rollback()
Definition WsfPProxyUndo.hpp:263
bool MoveToAttr(const WsfPProxyKey &aKey)
Definition WsfPProxyUndo.hpp:183
bool MoveToAttr(const WsfParseTypePath &aLookupPath)
Definition WsfPProxyUndo.hpp:206
bool MapInsert(const std::string &aMapKey, WsfPProxyValue aValue)
Definition WsfPProxyUndo.hpp:159
const WsfPProxyPath & GetPath() const
Definition WsfPProxyUndo.hpp:293
void Commit(size_t aHistoryIndex=0)
Definition WsfPProxyUndo.hpp:284
void DisableUndo()
Definition WsfPProxyUndo.hpp:129
WsfPProxyUndoValue(WsfPProxyValue aValue)
Definition WsfPProxyUndo.hpp:109
WsfPProxyUndoValue & operator=(const WsfPProxyUndoValue &aRhs)
Definition WsfPProxyUndo.hpp:137
bool MapDelete(const std::string &aMapKey)
Definition WsfPProxyUndo.hpp:163
WsfPProxyUndoValue GetAttr(const WsfPProxyPath &aPath) const
Definition WsfPProxyUndo.hpp:240
void Rollback(size_t aHistoryIndex)
Definition WsfPProxyUndo.hpp:270
bool MoveToAttr(size_t aIndex)
Definition WsfPProxyUndo.hpp:165
WsfPProxyPath mPath
Definition WsfPProxyUndo.hpp:311
WsfPProxyUndoValue()
Definition WsfPProxyUndo.hpp:104
bool MoveToAttr(const WsfPProxyPath &aPath)
Definition WsfPProxyUndo.hpp:194
WsfPProxyValue Get() const
Definition WsfPProxyUndo.hpp:254
bool Assign(WsfPProxyValue aNewValue)
Assigns a new value. aNewValue's memory is now maintained by WsfPProxyUndo and should not be used dir...
Definition WsfPProxyUndo.hpp:155
WsfPProxyUndoValue GetAttr(const std::string &aKey) const
Definition WsfPProxyUndo.hpp:228
WsfPProxyUndo * GetUndo() const
Definition WsfPProxyUndo.hpp:295
bool ListPush()
Definition WsfPProxyUndo.hpp:164
WsfPProxyUndo * mUndoPtr
Definition WsfPProxyUndo.hpp:312
WsfPProxyUndoValue(const WsfPProxyUndoValue &aSrc)
Definition WsfPProxyUndo.hpp:114
bool Exists() const
Definition WsfPProxyUndo.hpp:262
~WsfPProxyUndoValue()
Definition WsfPProxyUndo.hpp:136
size_t GetHistorySize() const
Definition WsfPProxyUndo.hpp:289
Definition WsfPProxyUndo.hpp:69
virtual void Undo(WsfPProxyUndo *aThis)=0
virtual ~ActionBase()
Definition WsfPProxyUndo.hpp:71
Definition WsfPProxyUndo.hpp:53
WsfPProxyUndo(const WsfPProxyUndo &)=delete
size_t GetHistorySize()
Definition WsfPProxyUndo.hpp:75
WsfPProxyUndo(WsfPProxyValue aRoot)
Definition WsfPProxyUndo.hpp:59
friend class WsfPProxyUndo_ActionMapOp
Definition WsfPProxyUndo.hpp:56
friend class WsfPProxyUndo_ActionAssign
Definition WsfPProxyUndo.hpp:55
friend class WsfPProxyUndo_ActionListOp
Definition WsfPProxyUndo.hpp:57
WsfPProxyUndo & operator=(const WsfPProxyUndo &)=delete
~WsfPProxyUndo()
Definition WsfPProxyUndo.hpp:67
const WsfPProxyValue & Root() const
Definition WsfPProxyUndo.hpp:84
void Commit(size_t aHistoryIndex=0)
Definition WsfPProxyUndo.cpp:295
void DisableUndo()
Definition WsfPProxyUndo.hpp:89
Definition WsfPProxyValue.hpp:33