mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-05 13:26:21 +00:00
--boost; style issues.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21497 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
a1eb7cac0e
commit
be85a6fcb5
@ -15,8 +15,6 @@
|
||||
|
||||
#include "lfuns.h"
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
@ -32,7 +30,7 @@ class FuncRequest;
|
||||
* dynamically, for encapsulating a real action and an
|
||||
* argument. They are used for things like the menus.
|
||||
*/
|
||||
class LyXAction : boost::noncopyable {
|
||||
class LyXAction {
|
||||
public:
|
||||
/// category of an action, used in the Shortcuts dialog
|
||||
enum func_type {
|
||||
@ -56,6 +54,10 @@ private:
|
||||
};
|
||||
|
||||
public:
|
||||
/// noncopyable
|
||||
LyXAction(LyXAction const &);
|
||||
void operator=(LyXAction const &);
|
||||
|
||||
/// type for map between a function name and its action
|
||||
typedef std::map<std::string, kb_action> func_map;
|
||||
/// type for map between an action and its info
|
||||
|
@ -11,11 +11,11 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "debug.h"
|
||||
#include "Lexer.h"
|
||||
#include "ModuleList.h"
|
||||
|
||||
#include "support/docstring.h"
|
||||
#include "debug.h"
|
||||
#include "Lexer.h"
|
||||
|
||||
#include "support/filetools.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
@ -26,7 +26,7 @@ using std::map;
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
namespace lyx{
|
||||
namespace lyx {
|
||||
|
||||
using support::FileName;
|
||||
using support::libFileSearch;
|
||||
@ -37,20 +37,19 @@ ModuleList moduleList;
|
||||
|
||||
|
||||
// used when sorting the module list.
|
||||
class moduleSorter
|
||||
: public std::binary_function<LyXModule, LyXModule, int>
|
||||
class ModuleSorter
|
||||
{
|
||||
public:
|
||||
int operator()(LyXModule const & lm1,
|
||||
LyXModule const & lm2) const
|
||||
{
|
||||
return (lm1.name < lm2.name);
|
||||
}
|
||||
public:
|
||||
int operator()(LyXModule const & lm1, LyXModule const & lm2) const
|
||||
{
|
||||
return lm1.name < lm2.name;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//Much of this is borrowed from TextClassList::read()
|
||||
bool ModuleList::load() {
|
||||
bool ModuleList::load()
|
||||
{
|
||||
support::FileName const real_file = libFileSearch("", "lyxmodules.lst");
|
||||
LYXERR(Debug::TCLASS) << "Reading modules from `"
|
||||
<< real_file << '\'' << endl;
|
||||
@ -120,13 +119,15 @@ bool ModuleList::load() {
|
||||
LYXERR(Debug::TCLASS) << "End of parsing of lyxmodules.lst" << endl;
|
||||
|
||||
if (!moduleList.empty())
|
||||
std::sort(moduleList.begin(), moduleList.end(), moduleSorter());
|
||||
std::sort(moduleList.begin(), moduleList.end(), ModuleSorter());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void ModuleList::addLayoutModule(string moduleName,
|
||||
string filename, string description, vector<string> pkgs) {
|
||||
void ModuleList::addLayoutModule(string const & moduleName,
|
||||
string const & filename, string const & description,
|
||||
vector<string> const & pkgs)
|
||||
{
|
||||
LyXModule lm;
|
||||
lm.name = moduleName;
|
||||
lm.filename = filename;
|
||||
@ -160,7 +161,8 @@ LyXModuleList::iterator ModuleList::end()
|
||||
}
|
||||
|
||||
|
||||
LyXModule * ModuleList::operator[](string const str) {
|
||||
LyXModule * ModuleList::operator[](string const & str)
|
||||
{
|
||||
LyXModuleList::iterator it = modlist_.begin();
|
||||
for (; it != modlist_.end(); ++it)
|
||||
if (it->name == str) {
|
||||
@ -170,4 +172,4 @@ LyXModule * ModuleList::operator[](string const str) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace lyx
|
||||
|
109
src/ModuleList.h
109
src/ModuleList.h
@ -12,64 +12,69 @@
|
||||
#ifndef MODULELIST_H
|
||||
#define MODULELIST_H
|
||||
|
||||
#include <vector>
|
||||
#include "support/FileName.h"
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
namespace lyx {
|
||||
|
||||
/**
|
||||
* This struct represents a particular LyX "module", which is a like a layout
|
||||
* file, except that it does not stand alone. In that sense, it is more like
|
||||
* a LaTeX package, where a layout file corresponds to a LaTeX class.
|
||||
*/
|
||||
struct LyXModule {
|
||||
/// what appears in the ui
|
||||
std::string name;
|
||||
/// the filename, without any path
|
||||
std::string filename;
|
||||
/// a short description for use in the ui
|
||||
std::string description;
|
||||
/// the LaTeX packages on which this depends, if any (not implemented)
|
||||
std::vector<std::string> packageList;
|
||||
/// whether those packages are available (not implemented yet)
|
||||
bool available;
|
||||
};
|
||||
|
||||
typedef std::vector<LyXModule> LyXModuleList;
|
||||
|
||||
/**
|
||||
* The ModuleList represents the various LyXModule's that are available at
|
||||
* present.
|
||||
*/
|
||||
class ModuleList : boost::noncopyable {
|
||||
public:
|
||||
/// reads the modules from a file generated by configure.py
|
||||
bool load();
|
||||
/// add a module to the list
|
||||
void addLayoutModule(std::string name, std::string filename,
|
||||
std::string description,
|
||||
std::vector<std::string> packages);
|
||||
///
|
||||
LyXModuleList::const_iterator begin() const;
|
||||
///
|
||||
LyXModuleList::iterator begin();
|
||||
///
|
||||
LyXModuleList::const_iterator end() const;
|
||||
///
|
||||
LyXModuleList::iterator end();
|
||||
///
|
||||
bool empty() { return modlist_.empty(); };
|
||||
/// Returns a pointer to the LyXModule with name str.
|
||||
/// Returns a null pointer if no such module is found.
|
||||
LyXModule * operator[](std::string str);
|
||||
private:
|
||||
std::vector<LyXModule> modlist_;
|
||||
};
|
||||
/**
|
||||
* This struct represents a particular LyX "module", which is a like a layout
|
||||
* file, except that it does not stand alone. In that sense, it is more like
|
||||
* a LaTeX package, where a layout file corresponds to a LaTeX class.
|
||||
*/
|
||||
struct LyXModule {
|
||||
/// what appears in the ui
|
||||
std::string name;
|
||||
/// the filename, without any path
|
||||
std::string filename;
|
||||
/// a short description for use in the ui
|
||||
std::string description;
|
||||
/// the LaTeX packages on which this depends, if any (not implemented)
|
||||
std::vector<std::string> packageList;
|
||||
/// whether those packages are available (not implemented yet)
|
||||
bool available;
|
||||
};
|
||||
|
||||
extern ModuleList moduleList;
|
||||
typedef std::vector<LyXModule> LyXModuleList;
|
||||
|
||||
/**
|
||||
* The ModuleList represents the various LyXModule's that are available at
|
||||
* present.
|
||||
*/
|
||||
class ModuleList {
|
||||
public:
|
||||
///
|
||||
ModuleList() {}
|
||||
/// reads the modules from a file generated by configure.py
|
||||
bool load();
|
||||
/// add a module to the list
|
||||
void addLayoutModule(std::string const & name,
|
||||
std::string const & filename, std::string const & description,
|
||||
std::vector<std::string> const & packages);
|
||||
///
|
||||
LyXModuleList::const_iterator begin() const;
|
||||
///
|
||||
LyXModuleList::iterator begin();
|
||||
///
|
||||
LyXModuleList::const_iterator end() const;
|
||||
///
|
||||
LyXModuleList::iterator end();
|
||||
///
|
||||
bool empty() const { return modlist_.empty(); }
|
||||
/// Returns a pointer to the LyXModule with name str.
|
||||
/// Returns a null pointer if no such module is found.
|
||||
LyXModule * operator[](std::string const & str);
|
||||
private:
|
||||
/// noncopyable
|
||||
ModuleList(ModuleList const &);
|
||||
void operator=(ModuleList const &);
|
||||
|
||||
///
|
||||
std::vector<LyXModule> modlist_;
|
||||
};
|
||||
|
||||
extern ModuleList moduleList;
|
||||
}
|
||||
#endif
|
||||
|
@ -9,16 +9,14 @@
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef LYXTEXTCLASSLIST_H
|
||||
#define LYXTEXTCLASSLIST_H
|
||||
#ifndef TEXTCLASSLIST_H
|
||||
#define TEXTCLASSLIST_H
|
||||
|
||||
#include "TextClass.h"
|
||||
|
||||
#include "support/strfwd.h"
|
||||
#include "support/types.h"
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
@ -30,7 +28,7 @@ class Layout;
|
||||
extern bool LyXSetStyle();
|
||||
|
||||
///
|
||||
class TextClassList : boost::noncopyable {
|
||||
class TextClassList {
|
||||
public:
|
||||
///
|
||||
typedef std::vector<TextClass> ClassList;
|
||||
@ -62,6 +60,10 @@ public:
|
||||
addTextClass(std::string const & textclass, std::string const & path);
|
||||
|
||||
private:
|
||||
/// noncopyable
|
||||
TextClassList(TextClassList const &);
|
||||
void operator=(TextClassList const &);
|
||||
|
||||
///
|
||||
mutable ClassList classlist_;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user