diff --git a/aegilib/aegilib.vcproj b/aegilib/aegilib.vcproj
index c62dd0d9b..b63836671 100644
--- a/aegilib/aegilib.vcproj
+++ b/aegilib/aegilib.vcproj
@@ -227,6 +227,10 @@
RelativePath=".\include\aegilib\tokenizer.h"
>
+
+
diff --git a/aegilib/include/aegilib/action.h b/aegilib/include/aegilib/action.h
index ca3097a16..dfba3cda0 100644
--- a/aegilib/include/aegilib/action.h
+++ b/aegilib/include/aegilib/action.h
@@ -47,15 +47,15 @@ namespace Aegilib {
class Action {
private:
ActionType type;
- void* data;
+ shared_ptr data;
int par1;
public:
Action();
- Action(ActionType type,void* data,int par1);
+ Action(ActionType type,shared_ptr data,int par1);
ActionType GetType() { return type; }
- void* GetData() { return data; }
+ shared_ptr GetData() { return data; }
int GetLineNumber() { return par1; }
};
};
diff --git a/aegilib/include/aegilib/aegilib.h b/aegilib/include/aegilib/aegilib.h
index d985b5e29..dd03f7d81 100644
--- a/aegilib/include/aegilib/aegilib.h
+++ b/aegilib/include/aegilib/aegilib.h
@@ -34,6 +34,7 @@
//
#pragma once
+#include "tr1.h"
#include "exception.h"
#include "model.h"
#include "view.h"
diff --git a/aegilib/include/aegilib/format.h b/aegilib/include/aegilib/format.h
index 53b512a40..3d9260457 100644
--- a/aegilib/include/aegilib/format.h
+++ b/aegilib/include/aegilib/format.h
@@ -35,6 +35,7 @@
#pragma once
#include "aegistring.h"
+#include "tr1.h"
namespace Aegilib {
// Prototypes
@@ -49,7 +50,7 @@ namespace Aegilib {
virtual String GetName() const = 0;
virtual StringArray GetReadExtensions() const = 0;
virtual StringArray GetWriteExtensions() const = 0;
- virtual FormatHandler* GetHandler(Model &model) const = 0;
+ virtual shared_ptr GetHandler(Model &model) const = 0;
virtual bool CanStoreText() const { return false; }
virtual bool CanStoreImages() const { return false; }
@@ -65,5 +66,6 @@ namespace Aegilib {
virtual int GetTimingPrecision() const { return 10; } // In milliseconds
virtual int GetMaxTime() const { return 36000000-10; } // In milliseconds, default 9h 59min 59.99s
};
+ typedef shared_ptr FormatPtr;
};
diff --git a/aegilib/include/aegilib/format_handler.h b/aegilib/include/aegilib/format_handler.h
index 9c7af0d51..2ad27b56f 100644
--- a/aegilib/include/aegilib/format_handler.h
+++ b/aegilib/include/aegilib/format_handler.h
@@ -35,15 +35,18 @@
#pragma once
#include "aegistring.h"
+#include "tr1.h"
namespace Aegilib {
// Format handler interface
class FormatHandler {
- public:
+ protected:
virtual ~FormatHandler() {}
+ public:
virtual void Load(wxInputStream &file,const String encoding) = 0;
};
+ typedef shared_ptr FormatHandlerPtr;
};
diff --git a/aegilib/include/aegilib/format_manager.h b/aegilib/include/aegilib/format_manager.h
index 556e25feb..c6abce0e8 100644
--- a/aegilib/include/aegilib/format_manager.h
+++ b/aegilib/include/aegilib/format_manager.h
@@ -41,18 +41,18 @@ namespace Aegilib {
// Format manager class
class FormatManager {
private:
- static std::vector formats;
+ static std::vector formats;
FormatManager() {}
public:
- static void AddFormat(const Format *format);
+ static void AddFormat(const FormatPtr format);
static void InitializeFormats();
static void ClearFormats();
static int GetFormatCount();
- static const Format* GetFormatByIndex(const int index);
- static const Format* GetFormatFromFilename(const String &filename,bool read);
- static const Format* GetFormatFromName(const String &name);
+ static const FormatPtr GetFormatByIndex(const int index);
+ static const FormatPtr GetFormatFromFilename(const String &filename,bool read);
+ static const FormatPtr GetFormatFromName(const String &name);
};
};
diff --git a/aegilib/include/aegilib/model.h b/aegilib/include/aegilib/model.h
index 6ec69a1bc..c28a178f6 100644
--- a/aegilib/include/aegilib/model.h
+++ b/aegilib/include/aegilib/model.h
@@ -43,6 +43,7 @@ namespace Aegilib {
// Prototypes
class View;
+ typedef shared_ptr ViewPtr;
class Notification;
class Format;
@@ -50,11 +51,12 @@ namespace Aegilib {
// Stores the subtitle data
class Model {
friend class Manipulator;
- typedef std::list ViewList;
+ typedef std::list ViewList;
typedef std::list ActionStack;
+ typedef shared_ptr FormatPtr;
private:
- std::list sections;
+ std::list sections;
ActionStack undoStack;
ActionStack redoStack;
ViewList listeners;
@@ -66,14 +68,14 @@ namespace Aegilib {
public:
const Format& GetFormat() const;
- void AddListener(View *listener);
+ void AddListener(ViewPtr listener);
- void Load(wxInputStream &input,const Format *format=NULL,const String encoding=L"");
- void Save(wxOutputStream &output,const Format *format=NULL,const String encoding=L"UTF-8");
+ void Load(wxInputStream &input,const FormatPtr format=FormatPtr(),const String encoding=L"");
+ void Save(wxOutputStream &output,const FormatPtr format=FormatPtr(),const String encoding=L"UTF-8");
void LoadFile(const String filename,const String encoding=L"");
void SaveFile(const String filename,const String encoding=L"UTF-8");
- Section* GetSection(String name) const;
+ SectionPtr GetSection(String name) const;
void AddSection(String name);
bool CanUndo(const String owner=L"") const;
diff --git a/aegilib/include/aegilib/section.h b/aegilib/include/aegilib/section.h
index 60adaf006..de952667b 100644
--- a/aegilib/include/aegilib/section.h
+++ b/aegilib/include/aegilib/section.h
@@ -36,6 +36,7 @@
#pragma once
#include "aegistring.h"
#include "section_entry.h"
+#include "tr1.h"
#include
#include