Indent + comments + use c++11 initializers

This commit is contained in:
Jean-Francois Dockes 2018-11-14 10:30:31 +01:00
parent f008457493
commit ea999ed6e5

View File

@ -32,8 +32,7 @@ namespace Rcl {
* indexer prior to adding to the index, and for querying, where * indexer prior to adding to the index, and for querying, where
* fields are filled from data stored in the index. Not all fields are * fields are filled from data stored in the index. Not all fields are
* in use at both index and query times, and not all field data is * in use at both index and query times, and not all field data is
* stored at index time (for example the "text" field is split and * stored at index time.
* indexed, but not stored as such)
*/ */
class Doc { class Doc {
public: public:
@ -51,7 +50,7 @@ class Doc {
// save the original path: // save the original path:
std::string idxurl; std::string idxurl;
// And the originating db. 0 is base, 1 first external etc. // And the originating db. 0 is base, 1 first external etc.
int idxi; int idxi{0};
// Internal path for multi-doc files. Ascii // Internal path for multi-doc files. Ascii
// Set by FsIndexer::processone // Set by FsIndexer::processone
@ -85,7 +84,7 @@ class Doc {
// Attribute for the "abstract" entry. true if it is just the top // Attribute for the "abstract" entry. true if it is just the top
// of doc, not a native document attribute. Not stored directly, but // of doc, not a native document attribute. Not stored directly, but
// as an indicative prefix at the beginning of the abstract (ugly hack) // as an indicative prefix at the beginning of the abstract (ugly hack)
bool syntabs; bool syntabs{false};
// File size. This is the size of the compressed file or of the // File size. This is the size of the compressed file or of the
// external containing archive. // external containing archive.
@ -120,19 +119,19 @@ class Doc {
///////////////////////////////////////////////// /////////////////////////////////////////////////
// Misc stuff // Misc stuff
int pc; // relevancy percentage, used by sortseq, convenience int pc{0}; // relevancy percentage, used by sortseq, convenience
unsigned long xdocid; // Opaque: rcldb doc identifier. unsigned long xdocid{0}; // Opaque: rcldb doc identifier.
// Page breaks were stored during indexing. // Page breaks were stored during indexing.
bool haspages; bool haspages{false};
// Has children, either as content of file-level container or // Has children, either as content of file-level container or
// ipath descendants. // ipath descendants.
bool haschildren; bool haschildren{false};
// During indexing: only fields from extended attributes were set, no // During indexing: only fields from extended attributes were set, no
// doc content. Allows for faster reindexing of existing doc // doc content. Allows for faster reindexing of existing doc
bool onlyxattr; bool onlyxattr{false};
/////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////
@ -156,21 +155,18 @@ class Doc {
pc = 0; pc = 0;
xdocid = 0; xdocid = 0;
idxi = 0;
haspages = false; haspages = false;
haschildren = false; haschildren = false;
onlyxattr = false; onlyxattr = false;
} }
// Copy ensuring no shared string data, for threading issues. // Copy ensuring no shared string data, for threading issues.
void copyto(Doc *d) const; void copyto(Doc *d) const;
Doc() Doc() { }
: idxi(0), syntabs(false), pc(0), xdocid(0),
haspages(false), haschildren(false), onlyxattr(false) {
}
/** Get value for named field. If value pointer is 0, just test existence */ /** Get value for named field. If value pointer is 0, just test existence */
bool getmeta(const std::string& nm, std::string *value = 0) const bool getmeta(const std::string& nm, std::string *value = 0) const {
{
const auto it = meta.find(nm); const auto it = meta.find(nm);
if (it != meta.end()) { if (it != meta.end()) {
if (value) if (value)
@ -180,9 +176,9 @@ class Doc {
return false; return false;
} }
} }
/** Nocopy getvalue. sets pointer to entry value if exists */ /** Nocopy getvalue. sets pointer to entry value if exists */
bool peekmeta(const std::string& nm, const std::string **value = 0) const bool peekmeta(const std::string& nm, const std::string **value = 0) const {
{
const auto it = meta.find(nm); const auto it = meta.find(nm);
if (it != meta.end()) { if (it != meta.end()) {
if (value) if (value)
@ -194,8 +190,7 @@ class Doc {
} }
// Create entry or append text to existing entry. // Create entry or append text to existing entry.
bool addmeta(const std::string& nm, const std::string& value) bool addmeta(const std::string& nm, const std::string& value) {
{
auto mit = meta.find(nm); auto mit = meta.find(nm);
if (mit == meta.end()) { if (mit == meta.end()) {
meta[nm] = value; meta[nm] = value;
@ -224,6 +219,7 @@ class Doc {
void dump(bool dotext=false) const; void dump(bool dotext=false) const;
////////////////////////////////////////////////////////////////
// The official names for recoll native fields when used in a text // The official names for recoll native fields when used in a text
// context (ie: the python interface duplicates some of the fixed // context (ie: the python interface duplicates some of the fixed
// fields in the meta array, these are the names used). Defined in // fields in the meta array, these are the names used). Defined in
@ -266,10 +262,10 @@ class Doc {
static const std::string keytt; // title static const std::string keytt; // title
static const std::string keykw; // keywords static const std::string keykw; // keywords
static const std::string keymd5; // file md5 checksum static const std::string keymd5; // file md5 checksum
static const std::string keybcknd; // backend type for data not from the filesys static const std::string keybcknd; // backend type when not from the fs
// udi back from index. Only set by Rcl::Query::getdoc(). // udi back from index. Only set by Rcl::Query::getdoc().
static const std::string keyudi; static const std::string keyudi;
static const std::string keyapptg; // apptag. Set from localfields (fsindexer) static const std::string keyapptg; // apptag. Set from localfields (fs only)
static const std::string keybght; // beagle hit type ("beagleHitType") static const std::string keybght; // beagle hit type ("beagleHitType")
}; };