Switch to side-by-side view

--- a/src/rcldb/rcldoc.h
+++ b/src/rcldb/rcldoc.h
@@ -19,8 +19,7 @@
 
 #include <string>
 #include <map>
-using std::string;
-using std::map;
+#include <vector>
 
 #include "smallut.h"
 
@@ -46,33 +45,33 @@
     // Binary or url-encoded url. No transcoding: this is used to access files 
     // Index: computed by Db::add caller. 
     // Query: from doc data.
-    string url;
+    std::string url;
 
     // When we do path translation for documents from external indexes, we
     // save the original path:
-    string idxurl;
+    std::string idxurl;
     // And the originating db. 0 is base, 1 first external etc.
     int idxi;
 
     // Internal path for multi-doc files. Ascii
     // Set by FsIndexer::processone    
-    string ipath;
+    std::string ipath;
 
     // Mime type. Set by FileInterner::internfile
-    string mimetype;     
+    std::string mimetype;     
 
     // File modification time as decimal ascii unix time
     // Set by FsIndexer::processone
-    string fmtime;
+    std::string fmtime;
 
     // Data reference date (same format). Ie: mail date
     // Possibly set by mimetype-specific handler
     // Filter::metaData["modificationdate"]
-    string dmtime;
+    std::string dmtime;
 
     // Charset we transcoded the 'text' field from (in case we want back)
     // Possibly set by handler
-    string origcharset;  
+    std::string origcharset;  
 
     // A map for textual metadata like, author, keywords, abstract,
     // title.  The entries are possibly set by the mimetype-specific
@@ -81,7 +80,7 @@
     // Only some predefined fields are stored in the data record:
     // "title", "keywords", "abstract", "author", but if a field name is
     // in the "stored" configuration list, it will be stored too.
-    map<string, string> meta; 
+    std::map<std::string, std::string> meta; 
 
     // Attribute for the "abstract" entry. true if it is just the top
     // of doc, not a native document attribute. Not stored directly, but
@@ -92,23 +91,23 @@
     // external containing archive.
     // Index: Set by caller prior to Db::Add. 
     // Query: Set from data record
-    string pcbytes;       
+    std::string pcbytes;       
 
     // Document size, ie, size of the .odt or .xls.
     // Index: Set in internfile from the filter stack
     // Query: set from data record
-    string fbytes;
+    std::string fbytes;
 
     // Doc text size. 
     // Index: from text.length(). 
     // Query: set by rcldb from index data record
-    string dbytes;
+    std::string dbytes;
 
     // Doc signature. Used for up to date checks. 
     // Index: set by Db::Add caller. Query: set from doc data.
     // This is opaque to rcldb, and could just as well be ctime, size,
     // ctime+size, md5, whatever.
-    string sig;
+    std::string sig;
 
     /////////////////////////////////////////////////
     // The following fields don't go to the db record, so they can't
@@ -116,7 +115,7 @@
 
     // Main document text. This is plaintext utf-8 text to be split
     // and indexed
-    string text; 
+    std::string text; 
 
     /////////////////////////////////////////////////
     // Misc stuff
@@ -170,9 +169,9 @@
 	  haspages(false), haschildren(false), onlyxattr(false) {
     }
     /** Get value for named field. If value pointer is 0, just test existence */
-    bool getmeta(const string& nm, string *value = 0) const
+    bool getmeta(const std::string& nm, std::string *value = 0) const
     {
-	map<string,string>::const_iterator it = meta.find(nm);
+	const auto it = meta.find(nm);
 	if (it != meta.end()) {
 	    if (value)
 		*value = it->second;
@@ -182,9 +181,9 @@
 	}
     }
     /** Nocopy getvalue. sets pointer to entry value if exists */
-    bool peekmeta(const string& nm, const string **value = 0) const
+    bool peekmeta(const std::string& nm, const std::string **value = 0) const
     {
-	map<string,string>::const_iterator it = meta.find(nm);
+	const auto it = meta.find(nm);
 	if (it != meta.end()) {
 	    if (value)
 		*value = &(it->second);
@@ -195,9 +194,9 @@
     }
 
     // Create entry or append text to existing entry.
-    bool addmeta(const string& nm, const string& value) 
+    bool addmeta(const std::string& nm, const std::string& value) 
     {
-	map<string,string>::iterator mit = meta.find(nm);
+	auto mit = meta.find(nm);
 	if (mit == meta.end()) {
 	    meta[nm] = value;
 	} else if (mit->second.empty()) {
@@ -206,7 +205,7 @@
 	    // It may happen that the same attr exists several times
 	    // in the internfile stack. Avoid duplicating values.
 	    if (mit->second != value)
-		mit->second += string(" - ") + value;
+		mit->second += std::string(" - ") + value;
 	}
 	return true;
     }
@@ -215,7 +214,7 @@
      * (as opposed to e.g. a webcache file), not a subdoc, 
      */
     bool isFsFile() {
-        string backend;
+        std::string backend;
         getmeta(keybcknd, &backend);
         if (!backend.empty() && backend.compare("FS"))
             return false;
@@ -232,10 +231,10 @@
     // author), _must_ use these canonical values, not aliases. This is 
     // enforced in internfile.cpp and misc other bits of metadata-gathering 
     // code
-    static const string keyurl; // url
+    static const std::string keyurl; // url
     // childurl. This is set when working with the parent of the result, to hold
     // the child of interest url, typically to highlight a directory entry
-    static const string keychildurl; 
+    static const std::string keychildurl; 
     // file name. This is set for filesystem-level containers or
     // documents, and not inherited by subdocuments (which can get a
     // keyfn anyway from, e.g, an attachment filename value).  Subdocs
@@ -243,37 +242,38 @@
     // usually don't want to see all subdocs when searching for the
     // file name). Instead the container file name is now set in the
     // document record but not indexed (see next entry).
-    static const string keyfn;  
+    static const std::string keyfn;  
     // Container file name. This is set for all subdocuments of a
     // given top level container. It is not indexed by default but
     // stored in the document record keyfn field if this is still
     // empty when we create it, for display purposes.
-    static const string keytcfn;
-    static const string keyipt; // ipath
-    static const string keytp;  // mime type
-    static const string keyfmt; // file mtime
-    static const string keydmt; // document mtime
-    static const string keymt;  // mtime dmtime if set else fmtime
-    static const string keyoc;  // original charset
-    static const string keypcs;  // document outer container size
-    static const string keyfs;  // document size
-    static const string keyds;  // document text size
-    static const string keysz;  // dbytes if set else fbytes else pcbytes
-    static const string keysig; // sig
-    static const string keyrr;  // relevancy rating
-    static const string keycc;  // Collapse count
-    static const string keyabs; // abstract
-    static const string keyau;  // author
-    static const string keytt;  // title
-    static const string keykw;  // keywords
-    static const string keymd5; // file md5 checksum
-    static const string keybcknd; // backend type for data not from the filesys
+    static const std::string keytcfn;
+    static const std::string keyipt; // ipath
+    static const std::string keytp;  // mime type
+    static const std::string keyfmt; // file mtime
+    static const std::string keydmt; // document mtime
+    static const std::string keymt;  // mtime dmtime if set else fmtime
+    static const std::string keyoc;  // original charset
+    static const std::string keypcs;  // document outer container size
+    static const std::string keyfs;  // document size
+    static const std::string keyds;  // document text size
+    static const std::string keysz;  // dbytes if set else fbytes else pcbytes
+    static const std::string keysig; // sig
+    static const std::string keyrr;  // relevancy rating
+    static const std::string keycc;  // Collapse count
+    static const std::string keyabs; // abstract
+    static const std::string keyau;  // author
+    static const std::string keytt;  // title
+    static const std::string keykw;  // keywords
+    static const std::string keymd5; // file md5 checksum
+    static const std::string keybcknd; // backend type for data not from the filesys
     // udi back from index. Only set by Rcl::Query::getdoc().
-    static const string keyudi;
-    static const string keyapptg; // apptag. Set from localfields (fsindexer)
-    static const string keybght;  // beagle hit type ("beagleHitType")
+    static const std::string keyudi;
+    static const std::string keyapptg; // apptag. Set from localfields (fsindexer)
+    static const std::string keybght;  // beagle hit type ("beagleHitType")
 };
 
+extern bool docsToPaths(std::vector<Doc> &docs,std::vector<std::string> &paths);
 
 }