Introduce docstring_list

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24924 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2008-05-24 10:15:52 +00:00
parent f46e57afa0
commit 8a7c802ab0
10 changed files with 60 additions and 18 deletions

View File

@ -297,6 +297,7 @@ src_support_header_files = Split('''
debug.h
docstream.h
docstring.h
docstring_list.h
environment.h
filetools.h
foreach.h

View File

@ -14,7 +14,6 @@
#include "ColorCode.h"
#include "support/strfwd.h"
#include "support/docstring.h"
#include <boost/function.hpp>
@ -25,6 +24,7 @@ namespace lyx {
class BufferView;
class Buffer;
class docstring_list;
class FuncRequest;
class FuncStatus;
class Inset;
@ -223,7 +223,7 @@ public:
virtual void unregisterSocketCallback(int fd) = 0;
virtual bool searchMenu(FuncRequest const & func,
std::vector<docstring> & names) const = 0;
docstring_list & names) const = 0;
};
} // namespace frontend

View File

@ -1036,7 +1036,7 @@ Buffer const * GuiApplication::updateInset(Inset const * inset) const
bool GuiApplication::searchMenu(FuncRequest const & func,
vector<docstring> & names) const
docstring_list & names) const
{
return d->menus_.searchMenu(func, names);
}

View File

@ -66,7 +66,7 @@ public:
std::string const hexName(ColorCode col);
void registerSocketCallback(int fd, SocketCallback func);
void unregisterSocketCallback(int fd);
bool searchMenu(FuncRequest const & func, std::vector<docstring> & names) const;
bool searchMenu(FuncRequest const & func, docstring_list & names) const;
void hideDialogs(std::string const & name, Inset * inset) const;
Buffer const * updateInset(Inset const * inset) const;
//@}

View File

@ -15,9 +15,11 @@
#include "GuiApplication.h"
#include "qt_helpers.h"
#include "support/gettext.h"
#include "Lexer.h"
#include "support/docstring.h"
#include "support/gettext.h"
#include <QTextBrowser>
#include <QSyntaxHighlighter>
#include <QClipboard>

View File

@ -55,6 +55,7 @@
#include "support/lassert.h"
#include "support/convert.h"
#include "support/debug.h"
#include "support/docstring_list.h"
#include "support/filetools.h"
#include "support/gettext.h"
#include "support/lstrings.h"
@ -269,7 +270,7 @@ public:
// search for func in this menu iteratively, and put menu
// names in a stack.
bool searchMenu(FuncRequest const & func, std::vector<docstring> & names)
bool searchMenu(FuncRequest const & func, docstring_list & names)
const;
///
bool hasFunc(FuncRequest const &) const;
@ -591,7 +592,7 @@ void MenuDefinition::checkShortcuts() const
}
bool MenuDefinition::searchMenu(FuncRequest const & func, vector<docstring> & names) const
bool MenuDefinition::searchMenu(FuncRequest const & func, docstring_list & names) const
{
const_iterator m = begin();
const_iterator m_end = end();
@ -995,10 +996,10 @@ void MenuDefinition::expandToc(Buffer const * buf)
void MenuDefinition::expandPasteRecent()
{
vector<docstring> const sel = cap::availableSelections();
docstring_list const sel = cap::availableSelections();
vector<docstring>::const_iterator cit = sel.begin();
vector<docstring>::const_iterator end = sel.end();
docstring_list::const_iterator cit = sel.begin();
docstring_list::const_iterator end = sel.end();
for (unsigned int index = 0; cit != end; ++cit, ++index) {
add(MenuItem(MenuItem::Command, toqstr(*cit),
@ -1091,11 +1092,11 @@ void MenuDefinition::expandCiteStyles(BufferView const * bv)
key = qstring_to_ucs4(toqstr(key).split(',')[0]);
vector<CiteStyle> citeStyleList = citeStyles(buf->params().citeEngine());
vector<docstring> citeStrings =
docstring_list citeStrings =
buf->masterBibInfo().getCiteStrings(key, bv->buffer());
vector<docstring>::const_iterator cit = citeStrings.begin();
vector<docstring>::const_iterator end = citeStrings.end();
docstring_list::const_iterator cit = citeStrings.begin();
docstring_list::const_iterator end = citeStrings.end();
for (int ii = 1; cit != end; ++cit, ++ii) {
docstring label = *cit;
@ -1520,7 +1521,7 @@ void Menus::read(Lexer & lex)
bool Menus::searchMenu(FuncRequest const & func,
vector<docstring> & names) const
docstring_list & names) const
{
MenuDefinition menu;
d->expand(d->menubar_, menu, 0);

View File

@ -13,8 +13,6 @@
#ifndef MENUS_H
#define MENUS_H
#include "support/docstring.h"
#include <QMenu>
#include <vector>
@ -24,6 +22,7 @@ class QMenuBar;
namespace lyx {
class docstring_list;
class Lexer;
class FuncRequest;
@ -63,7 +62,7 @@ public:
///
bool searchMenu(FuncRequest const & func,
std::vector<docstring> & names) const;
docstring_list & names) const;
///
void fillMenuBar(QMenuBar * qmb, GuiView * view, bool initial = false);

View File

@ -29,6 +29,7 @@
#include "support/debug.h"
#include "support/docstream.h"
#include "support/docstring_list.h"
#include "support/FileName.h"
#include "support/gettext.h"
#include "support/lstrings.h"
@ -205,7 +206,7 @@ void InsetInfo::updateInfo()
break;
}
case MENU_INFO: {
vector<docstring> names;
docstring_list names;
FuncRequest func = lyxaction.lookupFunc(name_);
if (func.action == LFUN_UNKNOWN_ACTION) {
setText(bformat(_("Unknown action %1$s"), from_utf8(name_)), bp.getFont(), false);

View File

@ -46,6 +46,7 @@ liblyxsupport_la_SOURCES = \
docstream.h \
docstring.cpp \
docstring.h \
docstring_list.h \
environment.h \
environment.cpp \
ExceptionMessage.h \

View File

@ -0,0 +1,37 @@
// -*- C++ -*-
/**
* \file docstring_list.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Abdelrazak Younes
*
* Full author contact details are available in file CREDITS.
*/
#ifndef DOCSTRINGLIST_H
#define DOCSTRINGLIST_H
#include "support/docstring.h"
#include <vector>
namespace lyx {
/**
* Class for storing docstring list.
* std::vector can not be forward declared in a simple way. Creating a class solves
* this problem.
*/
class docstring_list : public std::vector<docstring>
{
public:
docstring_list(): std::vector<docstring>() {}
docstring_list(std::vector<docstring> const & v) : std::vector<docstring>(v)
{}
};
} // namespace lyx
#endif // DOCSTRINGLIST_H