summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/htmlgen.cpp48
-rw-r--r--src/resourcemgr.h6
-rw-r--r--src/template.cpp21
3 files changed, 30 insertions, 45 deletions
diff --git a/src/htmlgen.cpp b/src/htmlgen.cpp
index 7908393..7e9c806 100644
--- a/src/htmlgen.cpp
+++ b/src/htmlgen.cpp
@@ -732,25 +732,17 @@ void HtmlGenerator::init()
QFile f(dname+"/dynsections.js");
if (f.open(IO_WriteOnly))
{
- const Resource *res = mgr.get("dynsections.js");
- if (res)
- {
- FTextStream t(&f);
- t << (const char *)res->data;
- if (Config_getBool("SOURCE_BROWSER") && Config_getBool("SOURCE_TOOLTIPS"))
- {
- t << endl <<
- "$(document).ready(function() {\n"
- " $('.code,.codeRef').each(function() {\n"
- " $(this).data('powertip',$('#'+$(this).attr('href').replace(/.*\\//,'').replace(/[^a-z_A-Z0-9]/g,'_')).html());\n"
- " $(this).powerTip({ placement: 's', smartPlacement: true, mouseOnToPopup: true });\n"
- " });\n"
- "});\n";
- }
- }
- else
+ FTextStream t(&f);
+ t << mgr.getAsString("dynsections.js");
+ if (Config_getBool("SOURCE_BROWSER") && Config_getBool("SOURCE_TOOLTIPS"))
{
- err("Resource dynsections.js not compiled in");
+ t << endl <<
+ "$(document).ready(function() {\n"
+ " $('.code,.codeRef').each(function() {\n"
+ " $(this).data('powertip',$('#'+$(this).attr('href').replace(/.*\\//,'').replace(/[^a-z_A-Z0-9]/g,'_')).html());\n"
+ " $(this).powerTip({ placement: 's', smartPlacement: true, mouseOnToPopup: true });\n"
+ " });\n"
+ "});\n";
}
}
}
@@ -815,20 +807,16 @@ void HtmlGenerator::writeSearchData(const char *dir)
QFile f(searchDirName+"/search.css");
if (f.open(IO_WriteOnly))
{
- const Resource *res = mgr.get("search.css");
- if (res)
+ FTextStream t(&f);
+ QCString searchCss = replaceColorMarkers(mgr.getAsString("search.css"));
+ searchCss = substitute(searchCss,"$doxygenversion",versionString);
+ if (Config_getBool("DISABLE_INDEX"))
{
- FTextStream t(&f);
- QCString searchCss = replaceColorMarkers((const char *)res->data);
- searchCss = substitute(searchCss,"$doxygenversion",versionString);
- if (Config_getBool("DISABLE_INDEX"))
- {
- // move up the search box if there are no tabs
- searchCss = substitute(searchCss,"margin-top: 8px;","margin-top: 0px;");
- }
- t << searchCss;
- Doxygen::indexList->addStyleSheetFile("search/search.css");
+ // move up the search box if there are no tabs
+ searchCss = substitute(searchCss,"margin-top: 8px;","margin-top: 0px;");
}
+ t << searchCss;
+ Doxygen::indexList->addStyleSheetFile("search/search.css");
}
}
diff --git a/src/resourcemgr.h b/src/resourcemgr.h
index 220202c..57b3e37 100644
--- a/src/resourcemgr.h
+++ b/src/resourcemgr.h
@@ -47,13 +47,13 @@ class ResourceMgr
/** Copies a registered resource to a given target directory under a given target name */
bool copyResourceAs(const char *name,const char *targetDir,const char *targetName) const;
- /** Returns a pointer to the resource object with the given name. */
- const Resource *get(const char *name) const;
-
/** Gets the resource data as a C string */
QCString getAsString(const char *name) const;
private:
+ /** Returns a pointer to the resource object with the given name. */
+ const Resource *get(const char *name) const;
+
ResourceMgr();
~ResourceMgr();
class Private;
diff --git a/src/template.cpp b/src/template.cpp
index f75d13e..debd8fa 100644
--- a/src/template.cpp
+++ b/src/template.cpp
@@ -2410,7 +2410,7 @@ class TemplateNodeList : public QList<TemplateNode>
class TemplateImpl : public TemplateNode, public Template
{
public:
- TemplateImpl(TemplateEngine *e,const QCString &name,const char *data,int size,
+ TemplateImpl(TemplateEngine *e,const QCString &name,const QCString &data,
const QCString &extension);
void render(FTextStream &ts, TemplateContext *c);
@@ -4537,7 +4537,7 @@ void TemplateBlockContext::push(TemplateNodeBlock *block)
class TemplateLexer
{
public:
- TemplateLexer(const TemplateEngine *engine,const QCString &fileName,const char *data,int size);
+ TemplateLexer(const TemplateEngine *engine,const QCString &fileName,const QCString &data);
void tokenize(QList<TemplateToken> &tokens);
void setOpenCloseCharacters(char openChar,char closeChar)
{ m_openChar=openChar; m_closeChar=closeChar; }
@@ -4553,12 +4553,9 @@ class TemplateLexer
char m_closeChar;
};
-TemplateLexer::TemplateLexer(const TemplateEngine *engine,const QCString &fileName,const char *data,int size) :
- m_engine(engine), m_fileName(fileName)
+TemplateLexer::TemplateLexer(const TemplateEngine *engine,const QCString &fileName,const QCString &data) :
+ m_engine(engine), m_fileName(fileName), m_data(data)
{
- m_data.resize(size+1);
- memcpy(m_data.rawData(),data,size);
- m_data[size]=0;
m_openChar='{';
m_closeChar='}';
}
@@ -4908,13 +4905,13 @@ void TemplateParser::warn(const char *fileName,int line,const char *fmt,...) con
//----------------------------------------------------------
-TemplateImpl::TemplateImpl(TemplateEngine *engine,const QCString &name,const char *data,int size,
+TemplateImpl::TemplateImpl(TemplateEngine *engine,const QCString &name,const QCString &data,
const QCString &extension)
: TemplateNode(0)
{
m_name = name;
m_engine = engine;
- TemplateLexer lexer(engine,name,data,size);
+ TemplateLexer lexer(engine,name,data);
if (extension=="tex")
{
lexer.setOpenCloseCharacters('<','>');
@@ -4988,10 +4985,10 @@ class TemplateEngine::Private
Template *templ = m_templateCache.find(fileName);
if (templ==0)
{
- const Resource *res = ResourceMgr::instance().get(fileName);
- if (res)
+ const QCString data = ResourceMgr::instance().getAsString(fileName);
+ if (!data.isEmpty())
{
- templ = new TemplateImpl(m_engine,fileName,(const char *)res->data,res->size,m_extension);
+ templ = new TemplateImpl(m_engine,fileName,data,m_extension);
m_templateCache.insert(fileName,templ);
}
else