1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-12-22 13:00:08 +00:00

reorganize coce

This commit is contained in:
Lu Wang 2012-12-11 20:17:36 +08:00
parent 59a571ac8a
commit 804f86b127
12 changed files with 52 additions and 28 deletions

View File

@ -155,8 +155,6 @@ add_executable(pdf2htmlEX
src/HTMLRenderer/link.cc src/HTMLRenderer/link.cc
src/HTMLRenderer/state.cc src/HTMLRenderer/state.cc
src/HTMLRenderer/text.cc src/HTMLRenderer/text.cc
src/HTMLRenderer/Preprocessor.h
src/HTMLRenderer/Preprocessor.cc
src/BackgroundRenderer/BackgroundRenderer.h src/BackgroundRenderer/BackgroundRenderer.h
src/BackgroundRenderer/SplashBackgroundRenderer.h src/BackgroundRenderer/SplashBackgroundRenderer.h
src/BackgroundRenderer/SplashBackgroundRenderer.cc src/BackgroundRenderer/SplashBackgroundRenderer.cc
@ -164,8 +162,8 @@ add_executable(pdf2htmlEX
src/BackgroundRenderer/CairoBackgroundRenderer.cc src/BackgroundRenderer/CairoBackgroundRenderer.cc
src/util/ArgParser.h src/util/ArgParser.h
src/util/ArgParser.cc src/util/ArgParser.cc
src/util/base64.h src/util/base64stream.h
src/util/base64.cc src/util/base64stream.cc
src/util/const.h src/util/const.h
src/util/const.cc src/util/const.cc
src/util/ffw.h src/util/ffw.h
@ -177,7 +175,10 @@ add_executable(pdf2htmlEX
src/util/namespace.h src/util/namespace.h
src/util/path.h src/util/path.h
src/util/path.cc src/util/path.cc
src/util/Preprocessor.h
src/util/Preprocessor.cc
src/util/StringFormatter.h src/util/StringFormatter.h
src/util/StringFormatter.cc
src/util/TmpFiles.h src/util/TmpFiles.h
src/util/TmpFiles.cc src/util/TmpFiles.cc
src/util/unicode.h src/util/unicode.h

View File

@ -1,5 +1,10 @@
Latest v0.6 Latest v0.6
* New parameter: --use-cropbox
* Progress indicator
* Create a glyph for ' ' when missing
* Code refining
v0.5 v0.5
2012.10.06 2012.10.06

6
debian/changelog vendored
View File

@ -1,3 +1,9 @@
pdf2htmlex (0.6-1~git201212111844rd76af-0ubuntu1) quantal; urgency=low
* Package for quantal
-- WANG Lu <coolwanglu@gmail.com> Tue, 11 Dec 2012 18:44:44 +0800
pdf2htmlex (0.6-1~git201210070052rcb9a8-0ubuntu1) precise; urgency=low pdf2htmlex (0.6-1~git201210070052rcb9a8-0ubuntu1) precise; urgency=low
* New version * New version

View File

@ -25,7 +25,7 @@
#include <Annot.h> #include <Annot.h>
#include "Param.h" #include "Param.h"
#include "Preprocessor.h" #include "util/Preprocessor.h"
#include "util/const.h" #include "util/const.h"
#include "util/StringFormatter.h" #include "util/StringFormatter.h"
#include "util/TmpFiles.h" #include "util/TmpFiles.h"

View File

@ -12,7 +12,7 @@
#include "HTMLRenderer.h" #include "HTMLRenderer.h"
#include "util/namespace.h" #include "util/namespace.h"
#include "util/base64.h" #include "util/base64stream.h"
#include "util/math.h" #include "util/math.h"
#include "util/misc.h" #include "util/misc.h"

View File

@ -18,7 +18,7 @@
#include "BackgroundRenderer/BackgroundRenderer.h" #include "BackgroundRenderer/BackgroundRenderer.h"
#include "util/namespace.h" #include "util/namespace.h"
#include "util/ffw.h" #include "util/ffw.h"
#include "util/base64.h" #include "util/base64stream.h"
#include "util/math.h" #include "util/math.h"
#include "util/path.h" #include "util/path.h"

View File

@ -0,0 +1,28 @@
#include <cstdarg>
#include "StringFormatter.h"
namespace pdf2htmlEX {
StringFormatter::GuardedPointer StringFormatter::operator () (const char * format, ...)
{
assert((buf_cnt == 0) && "StringFormatter: buffer is reused!");
va_list vlist;
va_start(vlist, format);
int l = vsnprintf(&buf.front(), buf.capacity(), format, vlist);
va_end(vlist);
if(l >= (int)buf.capacity())
{
buf.reserve(std::max<long>((long)(l+1), (long)buf.capacity() * 2));
va_start(vlist, format);
l = vsnprintf(&buf.front(), buf.capacity(), format, vlist);
va_end(vlist);
}
assert(l >= 0); // we should fail when vsnprintf fail
assert(l < (int)buf.capacity());
return GuardedPointer(this);
}
} //namespace pdf2htmlEX

View File

@ -29,24 +29,8 @@ public:
* Important: * Important:
* there is only one buffer, so new strings will replace old ones * there is only one buffer, so new strings will replace old ones
*/ */
GuardedPointer operator () (const char * format, ...) { GuardedPointer operator () (const char * format, ...);
assert((buf_cnt == 0) && "StringFormatter: buffer is reused!");
va_list vlist;
va_start(vlist, format);
int l = vsnprintf(&buf.front(), buf.capacity(), format, vlist);
va_end(vlist);
if(l >= (int)buf.capacity())
{
buf.reserve(std::max<long>((long)(l+1), (long)buf.capacity() * 2));
va_start(vlist, format);
l = vsnprintf(&buf.front(), buf.capacity(), format, vlist);
va_end(vlist);
}
assert(l >= 0); // we should fail when vsnprintf fail
assert(l < (int)buf.capacity());
return GuardedPointer(this);
}
private: private:
friend class GuardedPointer; friend class GuardedPointer;
std::vector<char> buf; std::vector<char> buf;

View File

@ -1,4 +1,4 @@
#include "base64.h" #include "base64stream.h"
namespace pdf2htmlEX { namespace pdf2htmlEX {

View File

@ -5,8 +5,8 @@
* 2012.11.29 * 2012.11.29
*/ */
#ifndef BASE64_H__ #ifndef BASE64STREAM_H__
#define BASE64_H__ #define BASE64STREAM_H__
#include <iostream> #include <iostream>
@ -30,4 +30,4 @@ std::ostream & operator << (std::ostream & out, base64stream & bf);
std::ostream & operator << (std::ostream & out, base64stream && bf); std::ostream & operator << (std::ostream & out, base64stream && bf);
} //namespace pdf2htmlEX } //namespace pdf2htmlEX
#endif //BASE64_H__ #endif //BASE64STREAM_H__