mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
remove expand.h
This commit is contained in:
parent
644c517d5a
commit
3a47a8b6e7
@ -8,7 +8,7 @@
|
||||
#define SOURCES \
|
||||
configTable.I configTable.h \
|
||||
config_dconfig.h config_notify.h config_setup.h \
|
||||
dconfig.I dconfig.h expand.I expand.h notify.I \
|
||||
dconfig.I dconfig.h notify.I \
|
||||
notify.h notifyCategory.I \
|
||||
notifyCategory.h notifyCategoryProxy.I notifyCategoryProxy.h \
|
||||
notifySeverity.h serialization.I serialization.h \
|
||||
@ -22,7 +22,7 @@
|
||||
#define INSTALL_HEADERS \
|
||||
configTable.I configTable.h config_dconfig.h config_setup.h \
|
||||
dconfig.I dconfig.h \
|
||||
expand.I expand.h notify.I notify.h notifyCategory.I \
|
||||
notify.I notify.h notifyCategory.I \
|
||||
notifyCategory.h notifyCategoryProxy.I notifyCategoryProxy.h \
|
||||
notifySeverity.h serialization.I serialization.h symbolEnt.I \
|
||||
symbolEnt.h
|
||||
|
@ -1,61 +0,0 @@
|
||||
// Filename: expand.I
|
||||
// Created by: cary (20Mar00)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://www.panda3d.org/license.txt .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d@yahoogroups.com .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
INLINE bool Base_Expander::isEnv(ConfigString S) {
|
||||
return (getenv(S.c_str()) != (TYPENAME ConfigString::value_type *)0L);
|
||||
}
|
||||
|
||||
INLINE ConfigString Base_Expander::Env(ConfigString S) {
|
||||
return isEnv(S)?getenv(S.c_str()):"";
|
||||
}
|
||||
|
||||
INLINE bool Base_Expander::isUser(ConfigString S) {
|
||||
if (S.find_first_of(VChars) == 0) {
|
||||
std::auto_ptr<struct passwd> pw(getpwnam(S.c_str()));
|
||||
return (pw.get() != (struct passwd *)0L);
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
|
||||
INLINE ConfigString Base_Expander::GetMyDir() {
|
||||
std::auto_ptr<struct passwd> pw(getpwuid(geteuid()));
|
||||
return pw->pw_dir;
|
||||
}
|
||||
|
||||
INLINE ConfigString Base_Expander::GetUserDir(ConfigString S) {
|
||||
std::auto_ptr<struct passwd> pw(getpwnam(S.c_str()));
|
||||
return ((pw.get() != (struct passwd *)0L)?pw->pw_dir:"");
|
||||
}
|
||||
|
||||
INLINE ConfigString Base_Expander::operator()(void) {
|
||||
return _result;
|
||||
}
|
||||
|
||||
INLINE ConfigString Base_Expander::operator()(ConfigString S) {
|
||||
_result = Base_Expander::Expand(S);
|
||||
return _result;
|
||||
}
|
||||
|
||||
INLINE Base_Expander::operator ConfigString() {
|
||||
return _result;
|
||||
}
|
||||
|
||||
INLINE ConfigString Expand(ConfigString S) {
|
||||
Base_Expander ex(S);
|
||||
return ex;
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
// Filename: expand.h
|
||||
// Created by: cary (26Aug98)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://www.panda3d.org/license.txt .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d@yahoogroups.com .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __EXPAND_H__
|
||||
#define __EXPAND_H__
|
||||
|
||||
#include "dtoolbase.h"
|
||||
|
||||
#include "pfstream.h"
|
||||
#include "config_setup.h"
|
||||
|
||||
#include <pwd.h>
|
||||
#include <memory>
|
||||
#include <sys/types.h>
|
||||
|
||||
namespace Expand {
|
||||
|
||||
static const ConfigString VChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.";
|
||||
|
||||
class Base_Expander {
|
||||
private:
|
||||
ConfigString _result;
|
||||
|
||||
ConfigString Strip(ConfigString S);
|
||||
INLINE bool isEnv(ConfigString S);
|
||||
INLINE ConfigString Env(ConfigString S);
|
||||
istream& CopyStreamToString(istream& is, ConfigString& S);
|
||||
INLINE bool isUser(ConfigString S);
|
||||
INLINE ConfigString GetMyDir();
|
||||
INLINE ConfigString GetUserDir(ConfigString S);
|
||||
ConfigString Expand(ConfigString S);
|
||||
Base_Expander() {}
|
||||
public:
|
||||
Base_Expander(ConfigString S) : _result(Base_Expander::Expand(S)) {}
|
||||
Base_Expander(const Base_Expander& c) : _result(c._result) {}
|
||||
~Base_Expander() {}
|
||||
INLINE ConfigString operator()();
|
||||
INLINE ConfigString operator()(ConfigString);
|
||||
INLINE operator ConfigString();
|
||||
};
|
||||
|
||||
typedef Base_Expander Expander;
|
||||
|
||||
INLINE ConfigString Expand(ConfigString S);
|
||||
|
||||
#include "expand.I"
|
||||
|
||||
} // Close namespace Expand
|
||||
|
||||
#endif /* __EXPAND_H__ */
|
Loading…
x
Reference in New Issue
Block a user