mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
*** empty log message ***
This commit is contained in:
parent
15d4d01836
commit
192dbfe946
@ -3,8 +3,8 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "dcbase.h"
|
||||
#include "dcFile.h"
|
||||
#include <dcbase.h>
|
||||
#include <dcFile.h>
|
||||
|
||||
int
|
||||
main(int argc, char *argv[]) {
|
||||
|
@ -7,6 +7,10 @@
|
||||
#include "dcParserDefs.h"
|
||||
#include "dcLexerDefs.h"
|
||||
|
||||
#ifdef WITHIN_PANDA
|
||||
#include <filename.h>
|
||||
#endif
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DCFile::Constructor
|
||||
@ -43,8 +47,15 @@ DCFile::
|
||||
// have been partially read).
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool DCFile::
|
||||
read(const string &filename) {
|
||||
ifstream in(filename.c_str());
|
||||
read(Filename filename) {
|
||||
ifstream in;
|
||||
|
||||
#ifdef WITHIN_PANDA
|
||||
filename.set_text();
|
||||
filename.open_read(in);
|
||||
#else
|
||||
in.open(filename.c_str());
|
||||
#endif
|
||||
|
||||
if (!in) {
|
||||
cerr << "Cannot open " << filename << " for reading.\n";
|
||||
@ -90,8 +101,15 @@ read(istream &in, const string &filename) {
|
||||
// written, false otherwise.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool DCFile::
|
||||
write(const string &filename) const {
|
||||
ofstream out(filename.c_str());
|
||||
write(Filename filename) const {
|
||||
ofstream out;
|
||||
|
||||
#ifdef WITHIN_PANDA
|
||||
filename.set_text();
|
||||
filename.open_write(out);
|
||||
#else
|
||||
out.open(filename.c_str());
|
||||
#endif
|
||||
|
||||
if (!out) {
|
||||
cerr << "Can't open " << filename << " for output.\n";
|
||||
|
@ -22,10 +22,10 @@ PUBLISHED:
|
||||
DCFile();
|
||||
~DCFile();
|
||||
|
||||
bool read(const string &filename);
|
||||
bool read(Filename filename);
|
||||
bool read(istream &in, const string &filename = string());
|
||||
|
||||
bool write(const string &filename) const;
|
||||
bool write(Filename filename) const;
|
||||
bool write(ostream &out, const string &filename = string()) const;
|
||||
|
||||
int get_num_classes();
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
#include <directbase.h>
|
||||
#include <notify.h>
|
||||
#include <filename.h>
|
||||
|
||||
#else
|
||||
|
||||
@ -70,6 +71,10 @@ using namespace std;
|
||||
#define EXPCL_DIRECT
|
||||
#define EXPTP_DIRECT
|
||||
|
||||
// Panda defines a special Filename class. We'll use an ordinary
|
||||
// string instead.
|
||||
typedef string Filename;
|
||||
|
||||
#endif // WITHIN_PANDA
|
||||
|
||||
#endif // DCBASE_H
|
||||
|
@ -28,9 +28,10 @@ class ClientRepository(DirectObject.DirectObject):
|
||||
|
||||
def parseDcFile(self, dcFileName):
|
||||
self.dcFile = DCFile()
|
||||
readResult = self.dcFile.read(dcFileName)
|
||||
fname = Filename(dcFileName)
|
||||
readResult = self.dcFile.read(fname)
|
||||
if not readResult:
|
||||
self.notify.error("Could not read dcfile: " + str(dcFileName.cStr()))
|
||||
self.notify.error("Could not read dcfile: " + dcFileName)
|
||||
return self.parseDcClasses(self.dcFile)
|
||||
|
||||
def parseDcClasses(self, dcFile):
|
||||
|
Loading…
x
Reference in New Issue
Block a user