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