@@ -53,29 +53,29 @@ namespace attributes {
5353 std::string path () const { return path_; }
5454 bool exists () const { return exists_; }
5555 time_t lastModified () const { return lastModified_; }
56-
56+
5757 std::string extension () const {
5858 std::string::size_type pos = path_.find_last_of (' .' );
5959 if (pos != std::string::npos)
6060 return path_.substr (pos);
6161 else
6262 return " " ;
6363 }
64-
64+
6565 bool operator <(const FileInfo& other) const {
6666 return path_ < other.path_ ;
6767 };
68-
68+
6969 bool operator ==(const FileInfo& other) const {
7070 return path_ == other.path_ &&
7171 exists_ == other.exists_ &&
7272 lastModified_ == other.lastModified_ ;
7373 };
74-
74+
7575 bool operator !=(const FileInfo& other) const {
7676 return ! (*this == other);
7777 };
78-
78+
7979 std::ostream& operator <<(std::ostream& os) const {
8080 os << path_;
8181 return os;
@@ -151,17 +151,17 @@ namespace attributes {
151151 {
152152 }
153153 bool empty () const { return name ().empty (); }
154-
154+
155155 bool operator ==(const Type& other) const {
156156 return name_ == other.name_ &&
157157 isConst_ == other.isConst_ &&
158158 isReference_ == other.isReference_ ;
159159 };
160-
160+
161161 bool operator !=(const Type& other) const {
162162 return !(*this == other);
163163 };
164-
164+
165165 const std::string& name () const { return name_; }
166166 std::string full_name () const {
167167 std::string res ;
@@ -193,17 +193,17 @@ namespace attributes {
193193 }
194194
195195 bool empty () const { return type ().empty (); }
196-
196+
197197 bool operator ==(const Argument& other) const {
198198 return name_ == other.name_ &&
199199 type_ == other.type_ &&
200200 defaultValue_ == other.defaultValue_ ;
201201 };
202-
202+
203203 bool operator !=(const Argument& other) const {
204204 return !(*this == other);
205205 };
206-
206+
207207
208208 const std::string& name () const { return name_; }
209209 const Type& type () const { return type_; }
@@ -238,21 +238,21 @@ namespace attributes {
238238 }
239239
240240 bool empty () const { return name ().empty (); }
241-
241+
242242 bool operator ==(const Function& other) const {
243243 return type_ == other.type_ &&
244244 name_ == other.name_ &&
245245 arguments_ == other.arguments_ ;
246246 };
247-
247+
248248 bool operator !=(const Function& other) const {
249249 return !(*this == other);
250250 };
251251
252252 const Type& type () const { return type_; }
253253 const std::string& name () const { return name_; }
254254 const std::vector<Argument>& arguments () const { return arguments_; }
255-
255+
256256 private:
257257 Type type_;
258258 std::string name_;
@@ -265,16 +265,16 @@ namespace attributes {
265265 Param () {}
266266 explicit Param (const std::string& paramText);
267267 bool empty () const { return name ().empty (); }
268-
268+
269269 bool operator ==(const Param& other) const {
270270 return name_ == other.name_ &&
271271 value_ == other.value_ ;
272272 };
273-
273+
274274 bool operator !=(const Param& other) const {
275275 return !(*this == other);
276276 };
277-
277+
278278
279279 const std::string& name () const { return name_; }
280280 const std::string& value () const { return value_; }
@@ -297,18 +297,18 @@ namespace attributes {
297297 }
298298
299299 bool empty () const { return name ().empty (); }
300-
300+
301301 bool operator ==(const Attribute& other) const {
302302 return name_ == other.name_ &&
303303 params_ == other.params_ &&
304304 function_ == other.function_ &&
305305 roxygen_ == other.roxygen_ ;
306306 };
307-
307+
308308 bool operator !=(const Attribute& other) const {
309309 return !(*this == other);
310310 };
311-
311+
312312
313313 const std::string& name () const { return name_; }
314314
@@ -471,7 +471,7 @@ namespace attributes {
471471 const std::vector<std::string>& embeddedR () const {
472472 return embeddedR_;
473473 }
474-
474+
475475 // Get source dependencies
476476 const std::vector<FileInfo>& sourceDependencies () const {
477477 return sourceDependencies_;
@@ -782,25 +782,25 @@ namespace attributes {
782782 pLines->push_back (line);
783783 }
784784 }
785-
786- bool addUniqueDependency (Rcpp::CharacterVector include,
785+
786+ bool addUniqueDependency (Rcpp::CharacterVector include,
787787 std::vector<FileInfo>* pDependencies) {
788-
788+
789789 // return false if we already have this include
790790 std::string path = Rcpp::as<std::string>(include);
791791 for (size_t i = 0 ; i<pDependencies->size (); ++i) {
792792 if (pDependencies->at (i).path () == path)
793793 return false ;
794794 }
795-
795+
796796 // add it and return true
797797 pDependencies->push_back (FileInfo (path));
798798 return true ;
799799 }
800-
800+
801801 void parseSourceDependencies (const std::string& sourceFile,
802802 std::vector<FileInfo>* pDependencies) {
803-
803+
804804 // import R functions
805805 Rcpp::Environment baseEnv = Rcpp::Environment::base_env ();
806806 Rcpp::Function dirname = baseEnv[" dirname" ];
@@ -810,25 +810,25 @@ namespace attributes {
810810 Rcpp::Environment toolsEnv = Rcpp::Environment::namespace_env (
811811 " tools" );
812812 Rcpp::Function filePathSansExt = toolsEnv[" file_path_sans_ext" ];
813-
813+
814814 // get the path to the source file's directory
815815 Rcpp::CharacterVector sourceDir = dirname (sourceFile);
816-
816+
817817 // read the source file into a buffer
818818 std::stringstream buffer;
819819 readFile (sourceFile, buffer);
820-
820+
821821 // Now read into a list of strings (which we can pass to regexec)
822822 // First read into a std::deque (which will handle lots of append
823823 // operations efficiently) then copy into an R chracter vector
824824 std::deque<std::string> lines;
825825 readLines (buffer, &lines);
826- Rcpp::CharacterVector linesVector = Rcpp::wrap (lines);
827-
826+ Rcpp::CharacterVector linesVector = Rcpp::wrap (lines);
827+
828828 // look for local includes
829829 Rcpp::List matches = regexMatches (
830830 linesVector, " ^\\ s*#include\\ s*\" ([^\" ]+)\"\\ s*$" );
831-
831+
832832 // accumulate local includes (skip commented sections)
833833 CommentState commentState;
834834 std::vector<FileInfo> newDependencies;
@@ -840,7 +840,7 @@ namespace attributes {
840840 const Rcpp::CharacterVector match = matches[i];
841841 if (match.size () == 2 ) {
842842 // compose a full file path for the match
843- Rcpp::CharacterVector include =
843+ Rcpp::CharacterVector include =
844844 filepath (sourceDir, std::string (match[1 ]));
845845 // if it exists then normalize and add to our list
846846 LogicalVector exists = fileExists (include);
@@ -850,19 +850,19 @@ namespace attributes {
850850 newDependencies.push_back (
851851 FileInfo (Rcpp::as<std::string>(include)));
852852 }
853-
853+
854854 std::vector<std::string> exts;
855855 exts.push_back (" .cc" );
856856 exts.push_back (" .cpp" );
857857 for (size_t i = 0 ; i<exts.size (); ++i) {
858-
858+
859859 // look for corresponding cpp file and add it
860860 std::string file = Rcpp::as<std::string>(
861861 filePathSansExt (include)) + exts[i];
862-
862+
863863 exists = fileExists (file);
864864 if (exists[0 ]) {
865- if (addUniqueDependency (file,
865+ if (addUniqueDependency (file,
866866 pDependencies)) {
867867 FileInfo fileInfo (file);
868868 newDependencies.push_back (fileInfo);
@@ -873,28 +873,28 @@ namespace attributes {
873873 }
874874 }
875875 }
876-
876+
877877 // look for dependencies recursively
878878 for (size_t i = 0 ; i<newDependencies.size (); i++) {
879879 FileInfo dependency = newDependencies[i];
880880 parseSourceDependencies (dependency.path (), pDependencies);
881881 }
882882 }
883-
883+
884884 // parse the source dependencies from the passed lines
885885 std::vector<FileInfo> parseSourceDependencies (
886886 const std::string& sourceFile) {
887-
887+
888888 // parse dependencies
889889 std::vector<FileInfo> dependencies;
890890 parseSourceDependencies (sourceFile, &dependencies);
891-
891+
892892 // remove main source file
893- dependencies.erase (std::remove (dependencies.begin (),
894- dependencies.end (),
895- FileInfo (sourceFile)),
896- dependencies.end ());
897-
893+ dependencies.erase (std::remove (dependencies.begin (),
894+ dependencies.end (),
895+ FileInfo (sourceFile)),
896+ dependencies.end ());
897+
898898 return dependencies;
899899 }
900900
@@ -1002,8 +1002,8 @@ namespace attributes {
10021002 }
10031003
10041004 // Print argument
1005- void printArgument (std::ostream& os,
1006- const Argument& argument,
1005+ void printArgument (std::ostream& os,
1006+ const Argument& argument,
10071007 bool printDefault = true ) {
10081008 if (!argument.empty ()) {
10091009 os << argument.type ();
@@ -1023,10 +1023,10 @@ namespace attributes {
10231023 }
10241024
10251025 // Print function
1026- void printFunction (std::ostream& os,
1027- const Function& function,
1028- bool printArgDefaults = true ) {
1029-
1026+ void printFunction (std::ostream& os,
1027+ const Function& function,
1028+ bool printArgDefaults = true ) {
1029+
10301030 if (!function.empty ()) {
10311031 if (!function.type ().empty ()) {
10321032 os << function.type ();
@@ -1175,30 +1175,30 @@ namespace attributes {
11751175
11761176 // Parse embedded R
11771177 embeddedR_ = parseEmbeddedR (lines_, lines);
1178-
1178+
11791179 // Recursively parse dependencies if requested
11801180 if (parseDependencies) {
1181-
1181+
11821182 // get source dependencies
11831183 sourceDependencies_ = parseSourceDependencies (sourceFile);
1184-
1184+
11851185 // parse attributes and modules from each dependent file
11861186 for (size_t i = 0 ; i<sourceDependencies_.size (); i++) {
1187-
1187+
11881188 // perform parse
11891189 std::string dependency = sourceDependencies_[i].path ();
11901190 SourceFileAttributesParser parser (dependency, false );
1191-
1191+
11921192 // copy to base attributes (if it's a new attribute)
1193- for (SourceFileAttributesParser::const_iterator
1193+ for (SourceFileAttributesParser::const_iterator
11941194 it = parser.begin (); it != parser.end (); ++it) {
11951195 if (std::find (attributes_.begin (),
11961196 attributes_.end (),
11971197 *it) == attributes_.end ()) {
11981198 attributes_.push_back (*it);
11991199 }
12001200 }
1201-
1201+
12021202 // copy to base modules
12031203 std::copy (parser.modules ().begin (),
12041204 parser.modules ().end (),
@@ -1273,7 +1273,7 @@ namespace attributes {
12731273 }
12741274 // rng that isn't true or false
12751275 else if (name == kExportRng ) {
1276- if (value != kParamValueFalse &&
1276+ if (value != kParamValueFalse &&
12771277 value != kParamValueTrue &&
12781278 value != kParamValueFALSE &&
12791279 value != kParamValueTRUE ) {
@@ -2833,7 +2833,7 @@ namespace {
28332833 cppSourcePath_);
28342834 if (sourceDependencies != sourceDependencies_)
28352835 return true ;
2836-
2836+
28372837 // not dirty
28382838 return false ;
28392839 }
@@ -2911,7 +2911,7 @@ namespace {
29112911
29122912 // capture embededded R
29132913 embeddedR_ = sourceAttributes.embeddedR ();
2914-
2914+
29152915 // capture source dependencies
29162916 sourceDependencies_ = sourceAttributes.sourceDependencies ();
29172917 }
@@ -2923,7 +2923,7 @@ namespace {
29232923 const std::string& cppSourcePath () const {
29242924 return cppSourcePath_;
29252925 }
2926-
2926+
29272927 const std::vector<std::string> cppDependencySourcePaths () {
29282928 std::vector<std::string> dependencies;
29292929 for (size_t i = 0 ; i<sourceDependencies_.size (); ++i) {
0 commit comments