summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2003-05-08 18:46:23 (GMT)
committerBrad King <brad.king@kitware.com>2003-05-08 18:46:23 (GMT)
commit43419192cb13b767585968115530274ab22459cf (patch)
treeaf06a6c130e3a76c2e2de0ea03ece0dc45795d74 /Source
parent332f4021911a7be31c89a697938ba469a624a9c3 (diff)
downloadCMake-43419192cb13b767585968115530274ab22459cf.zip
CMake-43419192cb13b767585968115530274ab22459cf.tar.gz
CMake-43419192cb13b767585968115530274ab22459cf.tar.bz2
ENH: Reduced header dependencies and cleaned up inclusion of standard headers.
Diffstat (limited to 'Source')
-rw-r--r--Source/kwsys/CMakeLists.txt14
-rw-r--r--Source/kwsys/Configure.hxx.in6
-rw-r--r--Source/kwsys/Directory.cxx73
-rw-r--r--Source/kwsys/Directory.hxx.in34
-rw-r--r--Source/kwsys/RegularExpression.hxx.in4
-rw-r--r--Source/kwsys/StandardIncludes.hxx.in6
-rw-r--r--Source/kwsys/kwsys_std.h.in15
7 files changed, 105 insertions, 47 deletions
diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt
index 6edaf3f..6b3cbf6 100644
--- a/Source/kwsys/CMakeLists.txt
+++ b/Source/kwsys/CMakeLists.txt
@@ -51,6 +51,20 @@ IF(KWSYS_INCLUDE_INSTALL_DIR)
FILES ${KWSYS_INCLUDES})
ENDIF(KWSYS_INCLUDE_INSTALL_DIR)
+#-----------------------------------------------------------------------------
+# Create STL header wrappers to block warnings in the STL headers.
+FOREACH(header algorithm deque iterator list map numeric queue set stack string
+ utility vector)
+ SET(KWSYS_STL_HEADER "${header}")
+ CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/kwsys_std.h.in
+ ${PROJECT_BINARY_DIR}/../${KWSYS_NAMESPACE}/std/${header}
+ @ONLY IMMEDIATE)
+ IF(KWSYS_INCLUDE_INSTALL_DIR)
+ INSTALL_FILES(${KWSYS_INCLUDE_INSTALL_DIR}/${KWSYS_NAMESPACE}
+ FILES ${PROJECT_BINARY_DIR}/../${KWSYS_NAMESPACE}/std/${header})
+ ENDIF(KWSYS_INCLUDE_INSTALL_DIR)
+ENDFOREACH(header)
+
IF(KWSYS_DEFAULTS)
INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR}/..)
ADD_EXECUTABLE(test1 test1.cxx)
diff --git a/Source/kwsys/Configure.hxx.in b/Source/kwsys/Configure.hxx.in
index baa9c74..68c8024 100644
--- a/Source/kwsys/Configure.hxx.in
+++ b/Source/kwsys/Configure.hxx.in
@@ -7,4 +7,10 @@
#cmakedefine KWSYS_NO_ANSI_STRING_STREAM
#cmakedefine KWSYS_NO_ANSI_FOR_SCOPE
+#if defined(KWSYS_NO_STD_NAMESPACE)
+# define kwsys_std
+#else
+# define kwsys_std std
+#endif
+
#endif
diff --git a/Source/kwsys/Directory.cxx b/Source/kwsys/Directory.cxx
index 3036081..5198ef8 100644
--- a/Source/kwsys/Directory.cxx
+++ b/Source/kwsys/Directory.cxx
@@ -16,6 +16,53 @@
=========================================================================*/
#include <Directory.hxx>
+#include <std/string>
+#include <std/vector>
+
+namespace KWSYS_NAMESPACE
+{
+
+//----------------------------------------------------------------------------
+class DirectoryInternals
+{
+public:
+ // Array of Files
+ kwsys_std::vector<kwsys_std::string> Files;
+
+ // Path to Open'ed directory
+ kwsys_std::string Path;
+};
+
+//----------------------------------------------------------------------------
+Directory::Directory()
+{
+ this->Internal = new DirectoryInternals;
+}
+
+//----------------------------------------------------------------------------
+Directory::~Directory()
+{
+ delete this->Internal;
+}
+
+//----------------------------------------------------------------------------
+unsigned long Directory::GetNumberOfFiles()
+{
+ return this->Internal->Files.size();
+}
+
+//----------------------------------------------------------------------------
+const char* Directory::GetFile(unsigned long dindex)
+{
+ if ( dindex >= this->Internal->Files.size() )
+ {
+ return 0;
+ }
+ return this->Internal->Files[dindex].c_str();
+}
+
+} // namespace KWSYS_NAMESPACE
+
// First microsoft compilers
#ifdef _MSC_VER
@@ -60,10 +107,10 @@ bool Directory::Load(const char* name)
// Loop through names
do
{
- m_Files.push_back(data.name);
+ this->Internal->Files.push_back(data.name);
}
while ( _findnext(srchHandle, &data) != -1 );
- m_Path = name;
+ this->Internal->Path = name;
return _findclose(srchHandle) != -1;
}
@@ -75,7 +122,7 @@ bool Directory::Load(const char* name)
#include <sys/types.h>
#include <dirent.h>
-
+
namespace KWSYS_NAMESPACE
{
@@ -90,27 +137,13 @@ bool Directory::Load(const char* name)
for (dirent* d = readdir(dir); d; d = readdir(dir) )
{
- m_Files.push_back(d->d_name);
+ this->Internal->Files.push_back(d->d_name);
}
- m_Path = name;
+ this->Internal->Path = name;
closedir(dir);
return 1;
}
-
+
} // namespace KWSYS_NAMESPACE
#endif
-
-namespace KWSYS_NAMESPACE
-{
-
-const char* Directory::GetFile(size_t dindex)
-{
- if ( dindex >= m_Files.size() )
- {
- return 0;
- }
- return m_Files[dindex].c_str();
-}
-
-} // namespace KWSYS_NAMESPACE
diff --git a/Source/kwsys/Directory.hxx.in b/Source/kwsys/Directory.hxx.in
index 799dde6..89cbf9d 100644
--- a/Source/kwsys/Directory.hxx.in
+++ b/Source/kwsys/Directory.hxx.in
@@ -17,18 +17,13 @@
#ifndef @KWSYS_NAMESPACE@_Directory_hxx
#define @KWSYS_NAMESPACE@_Directory_hxx
-#ifdef _MSC_VER
-#pragma warning ( disable : 4786 )
-#endif
-
-#include <@KWSYS_NAMESPACE@/StandardIncludes.hxx>
-
-#include <string>
-#include <vector>
+#include <@KWSYS_NAMESPACE@/Configure.hxx>
namespace @KWSYS_NAMESPACE@
{
+class DirectoryInternals;
+
/** \class Directory
* \brief Portable directory/filename traversal.
*
@@ -37,33 +32,34 @@ namespace @KWSYS_NAMESPACE@
*
* Directory currently works with Windows and Unix operating systems.
*/
-
class Directory
{
public:
+ Directory();
+ ~Directory();
+
/**
* Load the specified directory and load the names of the files
* in that directory. 0 is returned if the directory can not be
* opened, 1 if it is opened.
*/
- bool Load(const char* dir);
-
+ bool Load(const char*);
+
/**
* Return the number of files in the current directory.
*/
- size_t GetNumberOfFiles() { return m_Files.size();}
-
+ unsigned long GetNumberOfFiles();
+
/**
* Return the file at the given index, the indexing is 0 based
*/
- const char* GetFile(size_t );
-
+ const char* GetFile(unsigned long);
+
private:
- kwsys_std::vector<kwsys_std::string> m_Files; // Array of Files
- kwsys_std::string m_Path; // Path to Open'ed directory
-
+ // Private implementation details.
+ DirectoryInternals* Internal;
}; // End Class: Directory
-
+
} // namespace @KWSYS_NAMESPACE@
#endif
diff --git a/Source/kwsys/RegularExpression.hxx.in b/Source/kwsys/RegularExpression.hxx.in
index a766225..4b7698c 100644
--- a/Source/kwsys/RegularExpression.hxx.in
+++ b/Source/kwsys/RegularExpression.hxx.in
@@ -35,9 +35,9 @@
#ifndef @KWSYS_NAMESPACE@_RegularExpression_hxx
#define @KWSYS_NAMESPACE@_RegularExpression_hxx
-#include <@KWSYS_NAMESPACE@/StandardIncludes.hxx>
+#include <@KWSYS_NAMESPACE@/Configure.hxx>
-#include <string>
+#include <@KWSYS_NAMESPACE@/std/string>
namespace @KWSYS_NAMESPACE@
{
diff --git a/Source/kwsys/StandardIncludes.hxx.in b/Source/kwsys/StandardIncludes.hxx.in
index f91cec1..4346518 100644
--- a/Source/kwsys/StandardIncludes.hxx.in
+++ b/Source/kwsys/StandardIncludes.hxx.in
@@ -35,10 +35,4 @@
# include <strstream.h>
#endif
-#if defined(KWSYS_NO_STD_NAMESPACE)
-# define kwsys_std
-#else
-# define kwsys_std std
-#endif
-
#endif
diff --git a/Source/kwsys/kwsys_std.h.in b/Source/kwsys/kwsys_std.h.in
new file mode 100644
index 0000000..efb504a
--- /dev/null
+++ b/Source/kwsys/kwsys_std.h.in
@@ -0,0 +1,15 @@
+#ifndef @KWSYS_NAMESPACE@_std_@KWSYS_STL_HEADER@
+#define @KWSYS_NAMESPACE@_std_@KWSYS_STL_HEADER@
+
+#ifdef _MSC_VER
+#pragma warning (push, 1)
+#pragma warning (disable: 4702)
+#endif
+
+#include <@KWSYS_STL_HEADER@>
+
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
+#endif