![]() |
00001 //--------------------------------------------------------------------------------------- 00002 // Copyright (c) 2001-2010 by PDFTron Systems Inc. All Rights Reserved. 00003 // Consult legal.txt regarding legal and license information. 00004 //--------------------------------------------------------------------------------------- 00005 00006 #ifndef H_CPPFDFDoc 00007 #define H_CPPFDFDoc 00008 00009 00010 #include <SDF/SDFDoc.h> 00011 #include <FDF/FDFField.h> 00012 #include <Common/Iterator.h> 00013 #include <C/FDF/TRN_FDFDoc.h> 00014 #include <PDF/Field.h> 00015 00016 namespace pdftron { 00017 namespace FDF { 00018 00030 typedef Common::Iterator<FDFField> FDFFieldIterator; 00031 00041 class FDFDoc 00042 { 00043 public: 00044 00048 FDFDoc(); 00049 00050 00058 FDFDoc(SDF::SDFDoc& sdfdoc); 00059 00065 FDFDoc (const char* filepath); 00066 FDFDoc (const UString& filepath); 00067 00081 FDFDoc (Filters::Filter stream); 00082 00092 FDFDoc (const char* buf, size_t buf_size); 00093 00097 ~FDFDoc (); 00098 00102 bool IsModified () const; 00103 00123 void Save(const UString& path); 00124 00135 void Save(const char* &out_buf, size_t& out_buf_size); 00136 00140 SDF::Obj GetTrailer (); 00141 00146 SDF::Obj GetRoot(); 00147 00151 SDF::Obj GetFDF(); 00152 00159 UString GetPDFFileName(); 00160 00167 void SetPDFFileName(const UString& filepath); 00168 00174 SDF::Obj GetID(); 00175 00181 void SetID(SDF::Obj id); 00182 00197 FDFFieldIterator GetFieldIterator(); 00198 FDFFieldIterator GetFieldIterator(const UString& field_name); 00199 00200 00208 FDFField GetField(const UString& field_name); 00209 00215 FDFField FieldCreate(const UString& field_name, PDF::Field::Type type, SDF::Obj field_value = 0); 00216 FDFField FieldCreate(const UString& field_name, PDF::Field::Type type, const UString& field_value); 00217 00221 SDF::SDFDoc& GetSDFDoc (); 00222 00226 static FDFDoc CreateFromXFDF( const UString& filepath ); 00227 void SaveAsXFDF( const UString& filepath ); 00228 00230 FDFDoc(TRN_FDFDoc impl); 00231 TRN_FDFDoc mp_doc; 00233 }; 00234 00235 00236 #include <Impl/FDFDoc.inl> 00237 00238 }; // namespace FDF 00239 }; // namespace pdftron 00240 00241 #endif 00242