general: Remove `using std::*` from headers
Also remove most `using namespace std;` statements. The only one that remains is in py_panda.h. Closes #350 Closes #335
This commit is contained in:
parent
d284cedbea
commit
b2bfb31114
|
|
@ -13,6 +13,10 @@
|
|||
|
||||
#include "aiBehaviors.h"
|
||||
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
using std::string;
|
||||
|
||||
static const float _PI = 3.14;
|
||||
|
||||
AIBehaviors::AIBehaviors() {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
#include "aiCharacter.h"
|
||||
|
||||
AICharacter::AICharacter(string model_name, NodePath model_np, double mass, double movt_force, double max_force) {
|
||||
AICharacter::AICharacter(std::string model_name, NodePath model_np, double mass, double movt_force, double max_force) {
|
||||
_name = model_name;
|
||||
_ai_char_np = model_np;
|
||||
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ void PathFinder::generate_path() {
|
|||
add_to_clist(nxt_node);
|
||||
}
|
||||
}
|
||||
cout<<"DESTINATION NOT REACHABLE MATE!"<<endl;
|
||||
std::cout << "DESTINATION NOT REACHABLE MATE!" << std::endl;
|
||||
_closed_list.clear();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
#include "aiWorld.h"
|
||||
|
||||
AIWorld::AIWorld(NodePath render) {
|
||||
_render = move(render);
|
||||
_render = std::move(render);
|
||||
}
|
||||
|
||||
AIWorld::~AIWorld() {
|
||||
|
|
@ -26,7 +26,7 @@ void AIWorld::add_ai_char(AICharacter *ai_char) {
|
|||
ai_char->_world = this;
|
||||
}
|
||||
|
||||
void AIWorld::remove_ai_char(string name) {
|
||||
void AIWorld::remove_ai_char(std::string name) {
|
||||
AICharPool::iterator it;
|
||||
for (it = _ai_char_pool.begin(); it != _ai_char_pool.end(); ++it) {
|
||||
AICharacter *ai_char = *it;
|
||||
|
|
@ -38,10 +38,10 @@ void AIWorld::remove_ai_char(string name) {
|
|||
}
|
||||
}
|
||||
|
||||
remove_ai_char_from_flock(move(name));
|
||||
remove_ai_char_from_flock(std::move(name));
|
||||
}
|
||||
|
||||
void AIWorld::remove_ai_char_from_flock(string name) {
|
||||
void AIWorld::remove_ai_char_from_flock(std::string name) {
|
||||
for (AICharacter *ai_char : _ai_char_pool) {
|
||||
for (Flock *flock : _flock_pool) {
|
||||
if (ai_char->_ai_char_flock_id == flock->get_id()) {
|
||||
|
|
@ -62,7 +62,7 @@ void AIWorld::remove_ai_char_from_flock(string name) {
|
|||
*/
|
||||
void AIWorld::print_list() {
|
||||
for (AICharacter *ai_char : _ai_char_pool) {
|
||||
cout << ai_char->_name << endl;
|
||||
std::cout << ai_char->_name << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ LVecBase3 Arrival::do_arrival() {
|
|||
return(desired_force);
|
||||
}
|
||||
|
||||
cout<<"Arrival works only with seek and pursue"<<endl;
|
||||
std::cout << "Arrival works only with seek and pursue" << std::endl;
|
||||
return(LVecBase3(0.0, 0.0, 0.0));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,10 @@
|
|||
|
||||
#include "pathFind.h"
|
||||
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
using std::string;
|
||||
|
||||
PathFind::PathFind(AICharacter *ai_ch) {
|
||||
_ai_char = ai_ch;
|
||||
|
||||
|
|
@ -68,7 +72,7 @@ void PathFind::create_nav_mesh(const char* navmesh_filename) {
|
|||
// Begin reading data from the file.
|
||||
while(!nav_mesh_file.eof()) {
|
||||
getline(nav_mesh_file, line);
|
||||
stringstream linestream (line);
|
||||
std::stringstream linestream (line);
|
||||
|
||||
// Stores all the data members in the line to the array. Data
|
||||
// structure:
|
||||
|
|
@ -125,7 +129,7 @@ void PathFind::assign_neighbor_nodes(const char* navmesh_filename){
|
|||
|
||||
while(!nav_mesh_file.eof()) {
|
||||
getline(nav_mesh_file, ln); // Gets main node data only. No neighbor nodes.
|
||||
stringstream linestream (ln);
|
||||
std::stringstream linestream (ln);
|
||||
for(int i = 0; i < 10; ++i) {
|
||||
getline(linestream, fields[i], ',');
|
||||
}
|
||||
|
|
@ -135,7 +139,7 @@ void PathFind::assign_neighbor_nodes(const char* navmesh_filename){
|
|||
gd_y = atoi(fields[3].c_str());
|
||||
for(int i = 0; i < 8; ++i) {
|
||||
getline(nav_mesh_file, ln); // Gets neighbor node data only. No main nodes.
|
||||
stringstream linestream_n (ln);
|
||||
std::stringstream linestream_n (ln);
|
||||
for(int j = 0; j < 10; ++j) {
|
||||
getline(linestream_n, fields_n[j], ',');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ void PathFollow::add_to_path(LVecBase3 pos) {
|
|||
/**
|
||||
* This function initiates the path follow behavior.
|
||||
*/
|
||||
void PathFollow::start(string type) {
|
||||
void PathFollow::start(std::string type) {
|
||||
_type = type;
|
||||
_start = true;
|
||||
if(_path.size() > 0) {
|
||||
|
|
|
|||
|
|
@ -57,13 +57,13 @@ GPUCommand::GPUCommand(CommandType command_type) {
|
|||
* in mind that integers might be shown in their binary float representation,
|
||||
* depending on the setting in the GPUCommand::convert_int_to_float method.
|
||||
*/
|
||||
void GPUCommand::write(ostream &out) const {
|
||||
out << "GPUCommand(type=" << _command_type << ", size=" << _current_index << ", data = {" << endl;
|
||||
void GPUCommand::write(std::ostream &out) const {
|
||||
out << "GPUCommand(type=" << _command_type << ", size=" << _current_index << ", data = {" << std::endl;
|
||||
for (size_t k = 0; k < GPU_COMMAND_ENTRIES; ++k) {
|
||||
out << std::setw(12) << std::fixed << std::setprecision(5) << _data[k] << " ";
|
||||
if (k % 6 == 5 || k == GPU_COMMAND_ENTRIES - 1) out << endl;
|
||||
if (k % 6 == 5 || k == GPU_COMMAND_ENTRIES - 1) out << std::endl;
|
||||
}
|
||||
out << "})" << endl;
|
||||
out << "})" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ float IESDataset::get_candela_value(float vertical_angle, float horizontal_angle
|
|||
iesdataset_cat.error() << "Invalid horizontal lerp: " << lerp
|
||||
<< ", requested angle was " << horizontal_angle
|
||||
<< ", prev = " << prev_angle << ", cur = " << curr_angle
|
||||
<< endl;
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
return curr_value * lerp + prev_value * (1-lerp);
|
||||
|
|
@ -192,7 +192,7 @@ float IESDataset::get_vertical_candela_value(size_t horizontal_angle_idx, float
|
|||
iesdataset_cat.error() << "ERROR: Invalid vertical lerp: " << lerp
|
||||
<< ", requested angle was " << vertical_angle
|
||||
<< ", prev = " << prev_angle << ", cur = " << curr_angle
|
||||
<< endl;
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
return curr_value * lerp + prev_value * (1-lerp);
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@
|
|||
|
||||
#include <algorithm>
|
||||
|
||||
using std::endl;
|
||||
|
||||
NotifyCategoryDef(lightmgr, "");
|
||||
|
||||
|
||||
|
|
@ -355,7 +357,7 @@ bool InternalLightManager::compare_shadow_sources(const ShadowSource* a, const S
|
|||
void InternalLightManager::update_shadow_sources() {
|
||||
|
||||
// Find all dirty shadow sources and make a list of them
|
||||
vector<ShadowSource*> sources_to_update;
|
||||
std::vector<ShadowSource*> sources_to_update;
|
||||
for (auto iter = _shadow_sources.begin(); iter != _shadow_sources.end(); ++iter) {
|
||||
ShadowSource* source = *iter;
|
||||
if (source) {
|
||||
|
|
@ -393,7 +395,7 @@ void InternalLightManager::update_shadow_sources() {
|
|||
|
||||
// Free the regions of all sources which will get updated. We have to take into
|
||||
// account that only a limited amount of sources can get updated per frame.
|
||||
size_t update_slots = min(sources_to_update.size(),
|
||||
size_t update_slots = std::min(sources_to_update.size(),
|
||||
_shadow_manager->get_num_update_slots_left());
|
||||
for(size_t i = 0; i < update_slots; ++i) {
|
||||
if (sources_to_update[i]->has_region()) {
|
||||
|
|
|
|||
|
|
@ -131,13 +131,13 @@ LVecBase4i ShadowAtlas::find_and_reserve_region(size_t tile_width, size_t tile_h
|
|||
|
||||
// Check for empty region
|
||||
if (tile_width < 1 || tile_height < 1) {
|
||||
shadowatlas_cat.error() << "Called find_and_reserve_region with null-region!" << endl;
|
||||
shadowatlas_cat.error() << "Called find_and_reserve_region with null-region!" << std::endl;
|
||||
return LVecBase4i(-1);
|
||||
}
|
||||
|
||||
// Check for region bigger than the shadow atlas
|
||||
if (tile_width > _num_tiles || tile_height > _num_tiles) {
|
||||
shadowatlas_cat.error() << "Requested region exceeds shadow atlas size!" << endl;
|
||||
shadowatlas_cat.error() << "Requested region exceeds shadow atlas size!" << std::endl;
|
||||
return LVecBase4i(-1);
|
||||
}
|
||||
|
||||
|
|
@ -155,7 +155,7 @@ LVecBase4i ShadowAtlas::find_and_reserve_region(size_t tile_width, size_t tile_h
|
|||
// When we reached this part, we couldn't find a free region, so the atlas
|
||||
// seems to be full.
|
||||
shadowatlas_cat.error() << "Failed to find a free region of size " << tile_width
|
||||
<< " x " << tile_height << "!" << endl;
|
||||
<< " x " << tile_height << "!" << std::endl;
|
||||
return LVecBase4i(-1);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@
|
|||
|
||||
#include "tagStateManager.h"
|
||||
|
||||
using std::endl;
|
||||
|
||||
|
||||
NotifyCategoryDef(tagstatemgr, "");
|
||||
|
||||
|
|
@ -77,7 +79,7 @@ TagStateManager::
|
|||
*/
|
||||
void TagStateManager::
|
||||
apply_state(StateContainer& container, NodePath np, Shader* shader,
|
||||
const string &name, int sort) {
|
||||
const std::string &name, int sort) {
|
||||
if (tagstatemgr_cat.is_spam()) {
|
||||
tagstatemgr_cat.spam() << "Constructing new state " << name
|
||||
<< " with shader " << shader << endl;
|
||||
|
|
|
|||
|
|
@ -19,6 +19,9 @@
|
|||
#include "indent.h"
|
||||
#include "panda_getopt.h"
|
||||
|
||||
using std::cerr;
|
||||
using std::cout;
|
||||
|
||||
void
|
||||
usage() {
|
||||
cerr <<
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@
|
|||
#include "dcClassParameter.h"
|
||||
#include "hashGenerator.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
|
@ -201,13 +203,13 @@ validate_num_nested_fields(int num_nested_fields) const {
|
|||
* identifier.
|
||||
*/
|
||||
void DCArrayParameter::
|
||||
output_instance(ostream &out, bool brief, const string &prename,
|
||||
output_instance(std::ostream &out, bool brief, const string &prename,
|
||||
const string &name, const string &postname) const {
|
||||
if (get_typedef() != nullptr) {
|
||||
output_typedef_name(out, brief, prename, name, postname);
|
||||
|
||||
} else {
|
||||
ostringstream strm;
|
||||
std::ostringstream strm;
|
||||
|
||||
strm << "[";
|
||||
_array_size_range.output(strm);
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
#include <math.h>
|
||||
|
||||
using std::string;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
|
@ -151,7 +153,7 @@ get_element_divisor(int n) const {
|
|||
*
|
||||
*/
|
||||
void DCAtomicField::
|
||||
output(ostream &out, bool brief) const {
|
||||
output(std::ostream &out, bool brief) const {
|
||||
out << _name << "(";
|
||||
|
||||
if (!_elements.empty()) {
|
||||
|
|
@ -174,7 +176,7 @@ output(ostream &out, bool brief) const {
|
|||
* stream.
|
||||
*/
|
||||
void DCAtomicField::
|
||||
write(ostream &out, bool brief, int indent_level) const {
|
||||
write(std::ostream &out, bool brief, int indent_level) const {
|
||||
indent(out, indent_level);
|
||||
output(out, brief);
|
||||
out << ";";
|
||||
|
|
@ -270,7 +272,7 @@ do_check_match_atomic_field(const DCAtomicField *other) const {
|
|||
*
|
||||
*/
|
||||
void DCAtomicField::
|
||||
output_element(ostream &out, bool brief, DCParameter *element) const {
|
||||
output_element(std::ostream &out, bool brief, DCParameter *element) const {
|
||||
element->output(out, brief);
|
||||
|
||||
if (!brief && element->has_default_value()) {
|
||||
|
|
|
|||
|
|
@ -25,6 +25,10 @@
|
|||
#include "py_panda.h"
|
||||
#endif
|
||||
|
||||
using std::ostream;
|
||||
using std::ostringstream;
|
||||
using std::string;
|
||||
|
||||
#ifdef WITHIN_PANDA
|
||||
#include "pStatTimer.h"
|
||||
|
||||
|
|
@ -177,9 +181,9 @@ DCField *DCClass::
|
|||
get_field(int n) const {
|
||||
#ifndef NDEBUG //[
|
||||
if (n < 0 || n >= (int)_fields.size()) {
|
||||
cerr << *this << " "
|
||||
std::cerr << *this << " "
|
||||
<< "n:" << n << " _fields.size():"
|
||||
<< (int)_fields.size() << endl;
|
||||
<< (int)_fields.size() << std::endl;
|
||||
// __asm { int 3 }
|
||||
}
|
||||
#endif //]
|
||||
|
|
@ -749,7 +753,7 @@ pack_required_field(DCPacker &packer, PyObject *distobj,
|
|||
if (result == nullptr) {
|
||||
// We don't set this as an exception, since presumably the Python method
|
||||
// itself has already triggered a Python exception.
|
||||
cerr << "Error when calling " << getter_name << "\n";
|
||||
std::cerr << "Error when calling " << getter_name << "\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -128,8 +128,8 @@ get_nested_field(int n) const {
|
|||
* identifier.
|
||||
*/
|
||||
void DCClassParameter::
|
||||
output_instance(ostream &out, bool brief, const string &prename,
|
||||
const string &name, const string &postname) const {
|
||||
output_instance(std::ostream &out, bool brief, const std::string &prename,
|
||||
const std::string &name, const std::string &postname) const {
|
||||
if (get_typedef() != nullptr) {
|
||||
output_typedef_name(out, brief, prename, name, postname);
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ as_switch() const {
|
|||
* Write a string representation of this instance to <out>.
|
||||
*/
|
||||
void DCDeclaration::
|
||||
output(ostream &out) const {
|
||||
output(std::ostream &out) const {
|
||||
output(out, true);
|
||||
}
|
||||
|
||||
|
|
@ -65,6 +65,6 @@ output(ostream &out) const {
|
|||
* Write a string representation of this instance to <out>.
|
||||
*/
|
||||
void DCDeclaration::
|
||||
write(ostream &out, int indent_level) const {
|
||||
write(std::ostream &out, int indent_level) const {
|
||||
write(out, false, indent_level);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@
|
|||
#include "pStatTimer.h"
|
||||
#endif
|
||||
|
||||
using std::string;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
|
@ -232,7 +234,7 @@ pack_args(DCPacker &packer, PyObject *sequence) const {
|
|||
}
|
||||
|
||||
if (!Notify::ptr()->has_assert_failed()) {
|
||||
ostringstream strm;
|
||||
std::ostringstream strm;
|
||||
PyObject *exc_type = PyExc_Exception;
|
||||
|
||||
if (as_parameter() != nullptr) {
|
||||
|
|
@ -303,7 +305,7 @@ unpack_args(DCPacker &packer) const {
|
|||
}
|
||||
|
||||
if (!Notify::ptr()->has_assert_failed()) {
|
||||
ostringstream strm;
|
||||
std::ostringstream strm;
|
||||
PyObject *exc_type = PyExc_Exception;
|
||||
|
||||
if (packer.had_pack_error()) {
|
||||
|
|
@ -315,7 +317,7 @@ unpack_args(DCPacker &packer) const {
|
|||
dg.dump_hex(strm);
|
||||
size_t error_byte = packer.get_num_unpacked_bytes() - start_byte;
|
||||
strm << "Error detected on byte " << error_byte
|
||||
<< " (" << hex << error_byte << dec << " hex)";
|
||||
<< " (" << std::hex << error_byte << std::dec << " hex)";
|
||||
|
||||
exc_type = PyExc_RuntimeError;
|
||||
} else {
|
||||
|
|
@ -562,7 +564,7 @@ refresh_default_value() {
|
|||
packer.begin_pack(this);
|
||||
packer.pack_default_value();
|
||||
if (!packer.end_pack()) {
|
||||
cerr << "Error while packing default value for " << get_name() << "\n";
|
||||
std::cerr << "Error while packing default value for " << get_name() << "\n";
|
||||
} else {
|
||||
_default_value.assign(packer.get_data(), packer.get_length());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,9 @@
|
|||
#include "configVariableList.h"
|
||||
#endif
|
||||
|
||||
using std::cerr;
|
||||
using std::string;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -122,7 +125,7 @@ read(Filename filename) {
|
|||
#ifdef WITHIN_PANDA
|
||||
filename.set_text();
|
||||
VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr();
|
||||
istream *in = vfs->open_read_file(filename, true);
|
||||
std::istream *in = vfs->open_read_file(filename, true);
|
||||
if (in == nullptr) {
|
||||
cerr << "Cannot open " << filename << " for reading.\n";
|
||||
return false;
|
||||
|
|
@ -163,7 +166,7 @@ read(Filename filename) {
|
|||
* (in which case the file might have been partially read).
|
||||
*/
|
||||
bool DCFile::
|
||||
read(istream &in, const string &filename) {
|
||||
read(std::istream &in, const string &filename) {
|
||||
cerr << "DCFile::read of " << filename << "\n";
|
||||
dc_init_parser(in, filename, *this);
|
||||
dcyyparse();
|
||||
|
|
@ -203,7 +206,7 @@ write(Filename filename, bool brief) const {
|
|||
* Returns true if the description is successfully written, false otherwise.
|
||||
*/
|
||||
bool DCFile::
|
||||
write(ostream &out, bool brief) const {
|
||||
write(std::ostream &out, bool brief) const {
|
||||
if (!_imports.empty()) {
|
||||
Imports::const_iterator ii;
|
||||
for (ii = _imports.begin(); ii != _imports.end(); ++ii) {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
*
|
||||
*/
|
||||
DCKeyword::
|
||||
DCKeyword(const string &name, int historical_flag) :
|
||||
DCKeyword(const std::string &name, int historical_flag) :
|
||||
_name(name),
|
||||
_historical_flag(historical_flag)
|
||||
{
|
||||
|
|
@ -35,7 +35,7 @@ DCKeyword::
|
|||
/**
|
||||
* Returns the name of this keyword.
|
||||
*/
|
||||
const string &DCKeyword::
|
||||
const std::string &DCKeyword::
|
||||
get_name() const {
|
||||
return _name;
|
||||
}
|
||||
|
|
@ -64,7 +64,7 @@ clear_historical_flag() {
|
|||
* Write a string representation of this instance to <out>.
|
||||
*/
|
||||
void DCKeyword::
|
||||
output(ostream &out, bool brief) const {
|
||||
output(std::ostream &out, bool brief) const {
|
||||
out << "keyword " << _name;
|
||||
}
|
||||
|
||||
|
|
@ -72,7 +72,7 @@ output(ostream &out, bool brief) const {
|
|||
*
|
||||
*/
|
||||
void DCKeyword::
|
||||
write(ostream &out, bool, int indent_level) const {
|
||||
write(std::ostream &out, bool, int indent_level) const {
|
||||
indent(out, indent_level)
|
||||
<< "keyword " << _name << ";\n";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ DCKeywordList::
|
|||
* Returns true if this list includes the indicated keyword, false otherwise.
|
||||
*/
|
||||
bool DCKeywordList::
|
||||
has_keyword(const string &name) const {
|
||||
has_keyword(const std::string &name) const {
|
||||
return (_keywords_by_name.find(name) != _keywords_by_name.end());
|
||||
}
|
||||
|
||||
|
|
@ -92,7 +92,7 @@ get_keyword(int n) const {
|
|||
* is no keyword in the list with that name.
|
||||
*/
|
||||
const DCKeyword *DCKeywordList::
|
||||
get_keyword_by_name(const string &name) const {
|
||||
get_keyword_by_name(const std::string &name) const {
|
||||
KeywordsByName::const_iterator ni;
|
||||
ni = _keywords_by_name.find(name);
|
||||
if (ni != _keywords_by_name.end()) {
|
||||
|
|
@ -148,7 +148,7 @@ clear_keywords() {
|
|||
*
|
||||
*/
|
||||
void DCKeywordList::
|
||||
output_keywords(ostream &out) const {
|
||||
output_keywords(std::ostream &out) const {
|
||||
Keywords::const_iterator ki;
|
||||
for (ki = _keywords.begin(); ki != _keywords.end(); ++ki) {
|
||||
out << " " << (*ki)->get_name();
|
||||
|
|
|
|||
|
|
@ -610,11 +610,11 @@ static int error_count = 0;
|
|||
static int warning_count = 0;
|
||||
|
||||
// This is the pointer to the current input stream.
|
||||
static istream *input_p = NULL;
|
||||
static std::istream *input_p = nullptr;
|
||||
|
||||
// This is the name of the dc file we're parsing. We keep it so we
|
||||
// can print it out for error messages.
|
||||
static string dc_filename;
|
||||
static std::string dc_filename;
|
||||
|
||||
// This is the initial token state returned by the lexer. It allows
|
||||
// the yacc grammar to start from initial points.
|
||||
|
|
@ -626,7 +626,7 @@ static int initial_token;
|
|||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
void
|
||||
dc_init_lexer(istream &in, const string &filename) {
|
||||
dc_init_lexer(std::istream &in, const std::string &filename) {
|
||||
input_p = ∈
|
||||
dc_filename = filename;
|
||||
line_number = 0;
|
||||
|
|
@ -671,7 +671,9 @@ dcyywrap(void) {
|
|||
}
|
||||
|
||||
void
|
||||
dcyyerror(const string &msg) {
|
||||
dcyyerror(const std::string &msg) {
|
||||
using std::cerr;
|
||||
|
||||
cerr << "\nError";
|
||||
if (!dc_filename.empty()) {
|
||||
cerr << " in " << dc_filename;
|
||||
|
|
@ -686,7 +688,9 @@ dcyyerror(const string &msg) {
|
|||
}
|
||||
|
||||
void
|
||||
dcyywarning(const string &msg) {
|
||||
dcyywarning(const std::string &msg) {
|
||||
using std::cerr;
|
||||
|
||||
cerr << "\nWarning";
|
||||
if (!dc_filename.empty()) {
|
||||
cerr << " in " << dc_filename;
|
||||
|
|
@ -762,9 +766,9 @@ read_char(int &line, int &col) {
|
|||
|
||||
// scan_quoted_string reads a string delimited by quotation marks and
|
||||
// returns it.
|
||||
static string
|
||||
static std::string
|
||||
scan_quoted_string(char quote_mark) {
|
||||
string result;
|
||||
std::string result;
|
||||
|
||||
// We don't touch the current line number and column number during
|
||||
// scanning, so that if we detect an error while scanning the string
|
||||
|
|
@ -884,9 +888,9 @@ scan_quoted_string(char quote_mark) {
|
|||
|
||||
// scan_hex_string reads a string of hexadecimal digits delimited by
|
||||
// angle brackets and returns the representative string.
|
||||
static string
|
||||
static std::string
|
||||
scan_hex_string() {
|
||||
string result;
|
||||
std::string result;
|
||||
|
||||
// We don't touch the current line number and column number during
|
||||
// scanning, so that if we detect an error while scanning the string
|
||||
|
|
@ -916,7 +920,7 @@ scan_hex_string() {
|
|||
line_number = line;
|
||||
col_number = col;
|
||||
dcyyerror("Invalid hex digit.");
|
||||
return string();
|
||||
return std::string();
|
||||
}
|
||||
|
||||
odd = !odd;
|
||||
|
|
@ -930,10 +934,10 @@ scan_hex_string() {
|
|||
|
||||
if (c == EOF) {
|
||||
dcyyerror("This hex string is unterminated.");
|
||||
return string();
|
||||
return std::string();
|
||||
} else if (odd) {
|
||||
dcyyerror("Odd number of hex digits.");
|
||||
return string();
|
||||
return std::string();
|
||||
}
|
||||
|
||||
line_number = line;
|
||||
|
|
|
|||
|
|
@ -35,11 +35,11 @@ static int error_count = 0;
|
|||
static int warning_count = 0;
|
||||
|
||||
// This is the pointer to the current input stream.
|
||||
static istream *input_p = nullptr;
|
||||
static std::istream *input_p = nullptr;
|
||||
|
||||
// This is the name of the dc file we're parsing. We keep it so we
|
||||
// can print it out for error messages.
|
||||
static string dc_filename;
|
||||
static std::string dc_filename;
|
||||
|
||||
// This is the initial token state returned by the lexer. It allows
|
||||
// the yacc grammar to start from initial points.
|
||||
|
|
@ -51,7 +51,7 @@ static int initial_token;
|
|||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
void
|
||||
dc_init_lexer(istream &in, const string &filename) {
|
||||
dc_init_lexer(std::istream &in, const std::string &filename) {
|
||||
input_p = ∈
|
||||
dc_filename = filename;
|
||||
line_number = 0;
|
||||
|
|
@ -96,7 +96,9 @@ dcyywrap(void) {
|
|||
}
|
||||
|
||||
void
|
||||
dcyyerror(const string &msg) {
|
||||
dcyyerror(const std::string &msg) {
|
||||
using std::cerr;
|
||||
|
||||
cerr << "\nError";
|
||||
if (!dc_filename.empty()) {
|
||||
cerr << " in " << dc_filename;
|
||||
|
|
@ -111,7 +113,9 @@ dcyyerror(const string &msg) {
|
|||
}
|
||||
|
||||
void
|
||||
dcyywarning(const string &msg) {
|
||||
dcyywarning(const std::string &msg) {
|
||||
using std::cerr;
|
||||
|
||||
cerr << "\nWarning";
|
||||
if (!dc_filename.empty()) {
|
||||
cerr << " in " << dc_filename;
|
||||
|
|
@ -187,9 +191,9 @@ read_char(int &line, int &col) {
|
|||
|
||||
// scan_quoted_string reads a string delimited by quotation marks and
|
||||
// returns it.
|
||||
static string
|
||||
static std::string
|
||||
scan_quoted_string(char quote_mark) {
|
||||
string result;
|
||||
std::string result;
|
||||
|
||||
// We don't touch the current line number and column number during
|
||||
// scanning, so that if we detect an error while scanning the string
|
||||
|
|
@ -309,9 +313,9 @@ scan_quoted_string(char quote_mark) {
|
|||
|
||||
// scan_hex_string reads a string of hexadecimal digits delimited by
|
||||
// angle brackets and returns the representative string.
|
||||
static string
|
||||
static std::string
|
||||
scan_hex_string() {
|
||||
string result;
|
||||
std::string result;
|
||||
|
||||
// We don't touch the current line number and column number during
|
||||
// scanning, so that if we detect an error while scanning the string
|
||||
|
|
@ -341,7 +345,7 @@ scan_hex_string() {
|
|||
line_number = line;
|
||||
col_number = col;
|
||||
dcyyerror("Invalid hex digit.");
|
||||
return string();
|
||||
return std::string();
|
||||
}
|
||||
|
||||
odd = !odd;
|
||||
|
|
@ -355,10 +359,10 @@ scan_hex_string() {
|
|||
|
||||
if (c == EOF) {
|
||||
dcyyerror("This hex string is unterminated.");
|
||||
return string();
|
||||
return std::string();
|
||||
} else if (odd) {
|
||||
dcyyerror("Odd number of hex digits.");
|
||||
return string();
|
||||
return std::string();
|
||||
}
|
||||
|
||||
line_number = line;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
*
|
||||
*/
|
||||
DCMolecularField::
|
||||
DCMolecularField(const string &name, DCClass *dclass) : DCField(name, dclass) {
|
||||
DCMolecularField(const std::string &name, DCClass *dclass) : DCField(name, dclass) {
|
||||
_got_keywords = false;
|
||||
}
|
||||
|
||||
|
|
@ -109,7 +109,7 @@ add_atomic(DCAtomicField *atomic) {
|
|||
*
|
||||
*/
|
||||
void DCMolecularField::
|
||||
output(ostream &out, bool brief) const {
|
||||
output(std::ostream &out, bool brief) const {
|
||||
out << _name;
|
||||
|
||||
if (!_fields.empty()) {
|
||||
|
|
@ -130,7 +130,7 @@ output(ostream &out, bool brief) const {
|
|||
* stream.
|
||||
*/
|
||||
void DCMolecularField::
|
||||
write(ostream &out, bool brief, int indent_level) const {
|
||||
write(std::ostream &out, bool brief, int indent_level) const {
|
||||
indent(out, indent_level);
|
||||
output(out, brief);
|
||||
if (!brief) {
|
||||
|
|
|
|||
|
|
@ -23,6 +23,12 @@
|
|||
#include "py_panda.h"
|
||||
#endif
|
||||
|
||||
using std::istream;
|
||||
using std::istringstream;
|
||||
using std::ostream;
|
||||
using std::ostringstream;
|
||||
using std::string;
|
||||
|
||||
DCPacker::StackElement *DCPacker::StackElement::_deleted_chain = nullptr;
|
||||
int DCPacker::StackElement::_num_ever_allocated = 0;
|
||||
|
||||
|
|
@ -786,7 +792,7 @@ pack_object(PyObject *object) {
|
|||
pack_object(element);
|
||||
Py_DECREF(element);
|
||||
} else {
|
||||
cerr << "Unable to extract item " << i << " from sequence.\n";
|
||||
std::cerr << "Unable to extract item " << i << " from sequence.\n";
|
||||
}
|
||||
}
|
||||
pop();
|
||||
|
|
@ -903,7 +909,7 @@ unpack_object() {
|
|||
// constructor, create the class object instead of just a tuple.
|
||||
object = unpack_class_object(dclass);
|
||||
if (object == nullptr) {
|
||||
cerr << "Unable to construct object of class "
|
||||
std::cerr << "Unable to construct object of class "
|
||||
<< dclass->get_name() << "\n";
|
||||
} else {
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@
|
|||
#include "dcPacker.h"
|
||||
#include "dcSwitchParameter.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
/**
|
||||
* The catalog is created only by DCPackerInterface::get_catalog().
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@
|
|||
#include "dcParserDefs.h"
|
||||
#include "dcLexerDefs.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
|
@ -139,7 +141,7 @@ bool DCPackerInterface::
|
|||
check_match(const string &description, DCFile *dcfile) const {
|
||||
bool match = false;
|
||||
|
||||
istringstream strm(description);
|
||||
std::istringstream strm(description);
|
||||
dc_init_parser_parameter_description(strm, "check_match", dcfile);
|
||||
dcyyparse();
|
||||
dc_cleanup_parser();
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@
|
|||
#include "dcindent.h"
|
||||
#include "dcTypedef.h"
|
||||
|
||||
using std::ostream;
|
||||
using std::string;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -101,6 +101,10 @@
|
|||
#define YYINITDEPTH 1000
|
||||
#define YYMAXDEPTH 1000
|
||||
|
||||
using std::istream;
|
||||
using std::ostringstream;
|
||||
using std::string;
|
||||
|
||||
DCFile *dc_file = (DCFile *)NULL;
|
||||
static DCClass *current_class = (DCClass *)NULL;
|
||||
static DCSwitch *current_switch = (DCSwitch *)NULL;
|
||||
|
|
|
|||
|
|
@ -29,6 +29,10 @@
|
|||
#define YYINITDEPTH 1000
|
||||
#define YYMAXDEPTH 1000
|
||||
|
||||
using std::istream;
|
||||
using std::ostringstream;
|
||||
using std::string;
|
||||
|
||||
DCFile *dc_file = nullptr;
|
||||
static DCClass *current_class = nullptr;
|
||||
static DCSwitch *current_switch = nullptr;
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@
|
|||
#include "hashGenerator.h"
|
||||
#include <math.h>
|
||||
|
||||
using std::string;
|
||||
|
||||
DCSimpleParameter::NestedFieldMap DCSimpleParameter::_nested_field_map;
|
||||
DCClassParameter *DCSimpleParameter::_uint32uint8_type = nullptr;
|
||||
|
||||
|
|
@ -2171,7 +2173,7 @@ unpack_skip(const char *data, size_t length, size_t &p,
|
|||
* identifier.
|
||||
*/
|
||||
void DCSimpleParameter::
|
||||
output_instance(ostream &out, bool brief, const string &prename,
|
||||
output_instance(std::ostream &out, bool brief, const string &prename,
|
||||
const string &name, const string &postname) const {
|
||||
if (get_typedef() != nullptr) {
|
||||
output_typedef_name(out, brief, prename, name, postname);
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@
|
|||
|
||||
#include "dcSubatomicType.h"
|
||||
|
||||
ostream &
|
||||
operator << (ostream &out, DCSubatomicType type) {
|
||||
std::ostream &
|
||||
operator << (std::ostream &out, DCSubatomicType type) {
|
||||
switch (type) {
|
||||
case ST_int8:
|
||||
return out << "int8";
|
||||
|
|
|
|||
|
|
@ -18,6 +18,9 @@
|
|||
#include "dcindent.h"
|
||||
#include "dcPacker.h"
|
||||
|
||||
using std::ostream;
|
||||
using std::string;
|
||||
|
||||
/**
|
||||
* The key_parameter must be recently allocated via new; it will be deleted
|
||||
* via delete when the switch destructs.
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@
|
|||
#include "dcSwitch.h"
|
||||
#include "hashGenerator.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
|
@ -153,7 +155,7 @@ apply_switch(const char *value_data, size_t length) const {
|
|||
* identifier.
|
||||
*/
|
||||
void DCSwitchParameter::
|
||||
output_instance(ostream &out, bool brief, const string &prename,
|
||||
output_instance(std::ostream &out, bool brief, const string &prename,
|
||||
const string &name, const string &postname) const {
|
||||
if (get_typedef() != nullptr) {
|
||||
output_typedef_name(out, brief, prename, name, postname);
|
||||
|
|
@ -168,7 +170,7 @@ output_instance(ostream &out, bool brief, const string &prename,
|
|||
* identifier.
|
||||
*/
|
||||
void DCSwitchParameter::
|
||||
write_instance(ostream &out, bool brief, int indent_level,
|
||||
write_instance(std::ostream &out, bool brief, int indent_level,
|
||||
const string &prename, const string &name,
|
||||
const string &postname) const {
|
||||
if (get_typedef() != nullptr) {
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@
|
|||
#include "dcSimpleParameter.h"
|
||||
#include "dcindent.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
/**
|
||||
* The DCTypedef object becomes the owner of the supplied parameter pointer
|
||||
* and will delete it upon destruction.
|
||||
|
|
@ -72,7 +74,7 @@ get_name() const {
|
|||
*/
|
||||
string DCTypedef::
|
||||
get_description() const {
|
||||
ostringstream strm;
|
||||
std::ostringstream strm;
|
||||
_parameter->output(strm, true);
|
||||
return strm.str();
|
||||
}
|
||||
|
|
@ -122,7 +124,7 @@ set_number(int number) {
|
|||
* Write a string representation of this instance to <out>.
|
||||
*/
|
||||
void DCTypedef::
|
||||
output(ostream &out, bool brief) const {
|
||||
output(std::ostream &out, bool brief) const {
|
||||
out << "typedef ";
|
||||
_parameter->output(out, false);
|
||||
}
|
||||
|
|
@ -131,7 +133,7 @@ output(ostream &out, bool brief) const {
|
|||
*
|
||||
*/
|
||||
void DCTypedef::
|
||||
write(ostream &out, bool brief, int indent_level) const {
|
||||
write(std::ostream &out, bool brief, int indent_level) const {
|
||||
indent(out, indent_level)
|
||||
<< "typedef ";
|
||||
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
ostream &
|
||||
indent(ostream &out, int indent_level) {
|
||||
std::ostream &
|
||||
indent(std::ostream &out, int indent_level) {
|
||||
for (int i = 0; i < indent_level; i++) {
|
||||
out << ' ';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,9 +48,9 @@ add_int(int num) {
|
|||
* Adds a string to the hash, by breaking it down into a sequence of integers.
|
||||
*/
|
||||
void HashGenerator::
|
||||
add_string(const string &str) {
|
||||
add_string(const std::string &str) {
|
||||
add_int(str.length());
|
||||
string::const_iterator si;
|
||||
std::string::const_iterator si;
|
||||
for (si = str.begin(); si != str.end(); ++si) {
|
||||
add_int(*si);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ mark_position() {
|
|||
LVector3 pos_delta = _sample._pos - _smooth_pos;
|
||||
LVecBase3 hpr_delta = _sample._hpr - _smooth_hpr;
|
||||
double age = timestamp - _smooth_timestamp;
|
||||
age = min(age, _max_position_age);
|
||||
age = std::min(age, _max_position_age);
|
||||
|
||||
set_smooth_pos(_sample._pos, _sample._hpr, timestamp);
|
||||
if (age != 0.0) {
|
||||
|
|
@ -272,13 +272,13 @@ compute_smooth_position(double timestamp) {
|
|||
|
||||
// Find the newest of the points before the indicated time. Assume that
|
||||
// this will be no older than _last_point_before.
|
||||
i = max(0, _last_point_before);
|
||||
i = std::max(0, _last_point_before);
|
||||
while (i < num_points && _points[i]._timestamp < timestamp) {
|
||||
point_before = i;
|
||||
timestamp_before = _points[i]._timestamp;
|
||||
++i;
|
||||
}
|
||||
point_way_before = max(point_before - 1, -1);
|
||||
point_way_before = std::max(point_before - 1, -1);
|
||||
|
||||
// Now the next point is presumably the oldest point after the indicated
|
||||
// time.
|
||||
|
|
@ -527,7 +527,7 @@ get_latest_position() {
|
|||
*
|
||||
*/
|
||||
void SmoothMover::
|
||||
output(ostream &out) const {
|
||||
output(std::ostream &out) const {
|
||||
out << "SmoothMover, " << _points.size() << " sample points.";
|
||||
}
|
||||
|
||||
|
|
@ -535,7 +535,7 @@ output(ostream &out) const {
|
|||
*
|
||||
*/
|
||||
void SmoothMover::
|
||||
write(ostream &out) const {
|
||||
write(std::ostream &out) const {
|
||||
out << "SmoothMover, " << _points.size() << " sample points:\n";
|
||||
int num_points = _points.size();
|
||||
for (int i = 0; i < num_points; i++) {
|
||||
|
|
|
|||
|
|
@ -34,6 +34,11 @@
|
|||
#error Buildsystem error: BUILDING_DIRECT_DIRECTD not defined
|
||||
#endif
|
||||
|
||||
using std::cerr;
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
using std::string;
|
||||
|
||||
namespace {
|
||||
// ...This section is part of the old stuff from the original
|
||||
// implementation. The new stuff that uses job objects doesn't need this
|
||||
|
|
@ -148,7 +153,7 @@ DirectD::~DirectD() {
|
|||
int
|
||||
DirectD::client_ready(const string& server_host, int port,
|
||||
const string& cmd) {
|
||||
stringstream ss;
|
||||
std::stringstream ss;
|
||||
ss<<"!"<<cmd;
|
||||
send_one_message(server_host, port, ss.str());
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -13,6 +13,12 @@
|
|||
|
||||
#include "directdClient.h"
|
||||
|
||||
using std::cerr;
|
||||
using std::cin;
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
using std::string;
|
||||
|
||||
DirectDClient::DirectDClient() {
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,10 @@
|
|||
|
||||
#include "directdServer.h"
|
||||
|
||||
using std::cerr;
|
||||
using std::endl;
|
||||
using std::string;
|
||||
|
||||
DirectDServer::DirectDServer() {
|
||||
}
|
||||
|
||||
|
|
@ -61,8 +65,8 @@ void
|
|||
DirectDServer::read_command(string& cmd) {
|
||||
try {
|
||||
pifstream f;
|
||||
f.open("directdCommand", ios::in | ios::binary);
|
||||
stringstream ss;
|
||||
f.open("directdCommand", std::ios::in | std::ios::binary);
|
||||
std::stringstream ss;
|
||||
const int buf_size=512;
|
||||
char buf[buf_size];
|
||||
f.getline(buf, buf_size);
|
||||
|
|
|
|||
|
|
@ -28,6 +28,9 @@
|
|||
#include "py_panda.h"
|
||||
#endif
|
||||
|
||||
using std::endl;
|
||||
using std::string;
|
||||
|
||||
const string CConnectionRepository::_overflow_event_name = "CRDatagramOverflow";
|
||||
|
||||
#ifndef CPPPARSER
|
||||
|
|
@ -406,7 +409,7 @@ send_datagram(const Datagram &dg) {
|
|||
bool result = _bdc.SendMessage(dg);
|
||||
if (!result && _bdc.IsConnected()) {
|
||||
#ifdef HAVE_PYTHON
|
||||
ostringstream s;
|
||||
std::ostringstream s;
|
||||
|
||||
#if PY_VERSION_HEX >= 0x03030000
|
||||
PyObject *exc_type = PyExc_ConnectionError;
|
||||
|
|
@ -884,7 +887,7 @@ handle_update_field_owner() {
|
|||
* description on the indicated output stream.
|
||||
*/
|
||||
void CConnectionRepository::
|
||||
describe_message(ostream &out, const string &prefix,
|
||||
describe_message(std::ostream &out, const string &prefix,
|
||||
const Datagram &dg) const {
|
||||
DCPacker packer;
|
||||
|
||||
|
|
|
|||
|
|
@ -268,7 +268,7 @@ broadcast_pos_hpr_xy() {
|
|||
* indicated field name, up until the arguments.
|
||||
*/
|
||||
void CDistributedSmoothNodeBase::
|
||||
begin_send_update(DCPacker &packer, const string &field_name) {
|
||||
begin_send_update(DCPacker &packer, const std::string &field_name) {
|
||||
DCField *field = _dclass->get_field_by_name(field_name);
|
||||
nassertv(field != nullptr);
|
||||
|
||||
|
|
@ -325,14 +325,14 @@ finish_send_update(DCPacker &packer) {
|
|||
} else {
|
||||
#ifndef NDEBUG
|
||||
if (packer.had_range_error()) {
|
||||
ostringstream error;
|
||||
std::ostringstream error;
|
||||
error << "Node position out of range for DC file: "
|
||||
<< _node_path << " pos = " << _store_xyz
|
||||
<< " hpr = " << _store_hpr
|
||||
<< " zoneId = " << _currL[0];
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
string message = error.str();
|
||||
std::string message = error.str();
|
||||
distributed_cat.warning()
|
||||
<< message << "\n";
|
||||
PyErr_SetString(PyExc_ValueError, message.c_str());
|
||||
|
|
@ -364,5 +364,5 @@ set_curr_l(uint64_t l) {
|
|||
|
||||
void CDistributedSmoothNodeBase::
|
||||
print_curr_l() {
|
||||
cout << "printCurrL: sent l: " << _currL[1] << " last set l: " << _currL[0] << "\n";
|
||||
std::cout << "printCurrL: sent l: " << _currL[1] << " last set l: " << _currL[0] << "\n";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ TypeHandle CConstrainHprInterval::_type_handle;
|
|||
* node's local orientation will be copied unaltered.
|
||||
*/
|
||||
CConstrainHprInterval::
|
||||
CConstrainHprInterval(const string &name, double duration,
|
||||
CConstrainHprInterval(const std::string &name, double duration,
|
||||
const NodePath &node, const NodePath &target,
|
||||
bool wrt, const LVecBase3 hprOffset) :
|
||||
CConstraintInterval(name, duration),
|
||||
|
|
@ -69,7 +69,7 @@ priv_step(double t) {
|
|||
*
|
||||
*/
|
||||
void CConstrainHprInterval::
|
||||
output(ostream &out) const {
|
||||
output(std::ostream &out) const {
|
||||
out << get_name() << ":";
|
||||
out << " dur " << get_duration();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ TypeHandle CConstrainPosHprInterval::_type_handle;
|
|||
* unaltered.
|
||||
*/
|
||||
CConstrainPosHprInterval::
|
||||
CConstrainPosHprInterval(const string &name, double duration,
|
||||
CConstrainPosHprInterval(const std::string &name, double duration,
|
||||
const NodePath &node, const NodePath &target,
|
||||
bool wrt, const LVecBase3 posOffset,
|
||||
const LVecBase3 hprOffset) :
|
||||
|
|
@ -72,7 +72,7 @@ priv_step(double t) {
|
|||
*
|
||||
*/
|
||||
void CConstrainPosHprInterval::
|
||||
output(ostream &out) const {
|
||||
output(std::ostream &out) const {
|
||||
out << get_name() << ":";
|
||||
out << " dur " << get_duration();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ TypeHandle CConstrainPosInterval::_type_handle;
|
|||
* node's local position will be copied unaltered.
|
||||
*/
|
||||
CConstrainPosInterval::
|
||||
CConstrainPosInterval(const string &name, double duration,
|
||||
CConstrainPosInterval(const std::string &name, double duration,
|
||||
const NodePath &node, const NodePath &target,
|
||||
bool wrt, const LVecBase3 posOffset) :
|
||||
CConstraintInterval(name, duration),
|
||||
|
|
@ -73,7 +73,7 @@ priv_step(double t) {
|
|||
*
|
||||
*/
|
||||
void CConstrainPosInterval::
|
||||
output(ostream &out) const {
|
||||
output(std::ostream &out) const {
|
||||
out << get_name() << ":";
|
||||
out << " dur " << get_duration();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ TypeHandle CConstrainTransformInterval::_type_handle;
|
|||
* local transform will be copied unaltered.
|
||||
*/
|
||||
CConstrainTransformInterval::
|
||||
CConstrainTransformInterval(const string &name, double duration,
|
||||
CConstrainTransformInterval(const std::string &name, double duration,
|
||||
const NodePath &node, const NodePath &target,
|
||||
bool wrt) :
|
||||
CConstraintInterval(name, duration),
|
||||
|
|
@ -72,7 +72,7 @@ priv_step(double t) {
|
|||
*
|
||||
*/
|
||||
void CConstrainTransformInterval::
|
||||
output(ostream &out) const {
|
||||
output(std::ostream &out) const {
|
||||
out << get_name() << ":";
|
||||
out << " dur " << get_duration();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ TypeHandle CConstraintInterval::_type_handle;
|
|||
*
|
||||
*/
|
||||
CConstraintInterval::
|
||||
CConstraintInterval(const string &name, double duration) :
|
||||
CConstraintInterval(const std::string &name, double duration) :
|
||||
CInterval(name, duration, true)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,9 @@
|
|||
#include "eventQueue.h"
|
||||
#include "pStatTimer.h"
|
||||
|
||||
using std::ostream;
|
||||
using std::string;
|
||||
|
||||
PStatCollector CInterval::_root_pcollector("App:Show code:ivalLoop");
|
||||
TypeHandle CInterval::_type_handle;
|
||||
|
||||
|
|
@ -41,7 +44,7 @@ CInterval(const string &name, double duration, bool open_ended) :
|
|||
_curr_t(0.0),
|
||||
_name(name),
|
||||
_pname(get_pstats_name(name)),
|
||||
_duration(max(duration, 0.0)),
|
||||
_duration(std::max(duration, 0.0)),
|
||||
_open_ended(open_ended),
|
||||
_dirty(false),
|
||||
_ival_pcollector(_root_pcollector, _pname)
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ add_c_interval(CInterval *interval, bool external) {
|
|||
* interval, or -1 if there is not.
|
||||
*/
|
||||
int CIntervalManager::
|
||||
find_c_interval(const string &name) const {
|
||||
find_c_interval(const std::string &name) const {
|
||||
MutexHolder holder(_lock);
|
||||
|
||||
NameIndex::const_iterator ni = _name_index.find(name);
|
||||
|
|
@ -351,7 +351,7 @@ get_next_removal() {
|
|||
*
|
||||
*/
|
||||
void CIntervalManager::
|
||||
output(ostream &out) const {
|
||||
output(std::ostream &out) const {
|
||||
MutexHolder holder(_lock);
|
||||
|
||||
out << "CIntervalManager, " << (int)_name_index.size() << " intervals.";
|
||||
|
|
@ -361,7 +361,7 @@ output(ostream &out) const {
|
|||
*
|
||||
*/
|
||||
void CIntervalManager::
|
||||
write(ostream &out) const {
|
||||
write(std::ostream &out) const {
|
||||
MutexHolder holder(_lock);
|
||||
|
||||
// We need to write this line so that it's clear what's going on when there
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ priv_step(double t) {
|
|||
*
|
||||
*/
|
||||
void CLerpAnimEffectInterval::
|
||||
output(ostream &out) const {
|
||||
output(std::ostream &out) const {
|
||||
out << get_name() << ": ";
|
||||
|
||||
if (_controls.empty()) {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ TypeHandle CLerpInterval::_type_handle;
|
|||
* string, or BT_invalid if the string doesn't match anything.
|
||||
*/
|
||||
CLerpInterval::BlendType CLerpInterval::
|
||||
string_blend_type(const string &blend_type) {
|
||||
string_blend_type(const std::string &blend_type) {
|
||||
if (blend_type == "easeIn") {
|
||||
return BT_ease_in;
|
||||
} else if (blend_type == "easeOut") {
|
||||
|
|
@ -49,7 +49,7 @@ compute_delta(double t) const {
|
|||
return 1.0;
|
||||
}
|
||||
t /= duration;
|
||||
t = min(max(t, 0.0), 1.0);
|
||||
t = std::min(std::max(t, 0.0), 1.0);
|
||||
|
||||
switch (_blend_type) {
|
||||
case BT_ease_in:
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ TypeHandle CLerpNodePathInterval::_type_handle;
|
|||
* otherwise, it is reset.
|
||||
*/
|
||||
CLerpNodePathInterval::
|
||||
CLerpNodePathInterval(const string &name, double duration,
|
||||
CLerpNodePathInterval(const std::string &name, double duration,
|
||||
CLerpInterval::BlendType blend_type,
|
||||
bool bake_in_start, bool fluid,
|
||||
const NodePath &node, const NodePath &other) :
|
||||
|
|
@ -544,7 +544,7 @@ priv_reverse_instant() {
|
|||
*
|
||||
*/
|
||||
void CLerpNodePathInterval::
|
||||
output(ostream &out) const {
|
||||
output(std::ostream &out) const {
|
||||
out << get_name() << ":";
|
||||
|
||||
if ((_flags & F_end_pos) != 0) {
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@
|
|||
#include <math.h> // for log10()
|
||||
#include <stdio.h> // for sprintf()
|
||||
|
||||
using std::string;
|
||||
|
||||
TypeHandle CMetaInterval::_type_handle;
|
||||
|
||||
/**
|
||||
|
|
@ -669,7 +671,7 @@ pop_event() {
|
|||
*
|
||||
*/
|
||||
void CMetaInterval::
|
||||
write(ostream &out, int indent_level) const {
|
||||
write(std::ostream &out, int indent_level) const {
|
||||
recompute();
|
||||
|
||||
// How many digits of precision should we output for time?
|
||||
|
|
@ -698,7 +700,7 @@ write(ostream &out, int indent_level) const {
|
|||
* Outputs a list of all events in the order in which they occur.
|
||||
*/
|
||||
void CMetaInterval::
|
||||
timeline(ostream &out) const {
|
||||
timeline(std::ostream &out) const {
|
||||
recompute();
|
||||
|
||||
// How many digits of precision should we output for time?
|
||||
|
|
@ -1124,7 +1126,7 @@ recompute_level(int n, int level_begin, int &level_end) {
|
|||
|
||||
previous_begin = begin_time;
|
||||
previous_end = end_time;
|
||||
level_end = max(level_end, end_time);
|
||||
level_end = std::max(level_end, end_time);
|
||||
n++;
|
||||
}
|
||||
|
||||
|
|
@ -1169,7 +1171,7 @@ get_begin_time(const CMetaInterval::IntervalDef &def, int level_begin,
|
|||
* Formats an event for output, for write() or timeline().
|
||||
*/
|
||||
void CMetaInterval::
|
||||
write_event_desc(ostream &out, const CMetaInterval::IntervalDef &def,
|
||||
write_event_desc(std::ostream &out, const CMetaInterval::IntervalDef &def,
|
||||
int &extra_indent_level) const {
|
||||
switch (def._type) {
|
||||
case DT_c_interval:
|
||||
|
|
|
|||
|
|
@ -20,13 +20,13 @@ TypeHandle HideInterval::_type_handle;
|
|||
*
|
||||
*/
|
||||
HideInterval::
|
||||
HideInterval(const NodePath &node, const string &name) :
|
||||
HideInterval(const NodePath &node, const std::string &name) :
|
||||
CInterval(name, 0.0, true),
|
||||
_node(node)
|
||||
{
|
||||
nassertv(!node.is_empty());
|
||||
if (_name.empty()) {
|
||||
ostringstream name_strm;
|
||||
std::ostringstream name_strm;
|
||||
name_strm
|
||||
<< "HideInterval-" << node.node()->get_name() << "-" << ++_unique_index;
|
||||
_name = name_strm.str();
|
||||
|
|
|
|||
|
|
@ -20,13 +20,13 @@ TypeHandle ShowInterval::_type_handle;
|
|||
*
|
||||
*/
|
||||
ShowInterval::
|
||||
ShowInterval(const NodePath &node, const string &name) :
|
||||
ShowInterval(const NodePath &node, const std::string &name) :
|
||||
CInterval(name, 0.0, true),
|
||||
_node(node)
|
||||
{
|
||||
nassertv(!node.is_empty());
|
||||
if (_name.empty()) {
|
||||
ostringstream name_strm;
|
||||
std::ostringstream name_strm;
|
||||
name_strm
|
||||
<< "ShowInterval-" << node.node()->get_name() << "-" << ++_unique_index;
|
||||
_name = name_strm.str();
|
||||
|
|
|
|||
|
|
@ -15,6 +15,11 @@
|
|||
#include "p3d_lock.h"
|
||||
#include <sstream>
|
||||
|
||||
using std::istream;
|
||||
using std::ostream;
|
||||
using std::ostringstream;
|
||||
using std::string;
|
||||
|
||||
static const bool debug_xml_output = false;
|
||||
|
||||
static LOCK xml_lock;
|
||||
|
|
|
|||
|
|
@ -18,8 +18,6 @@
|
|||
#include "handleStream.h"
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
// A pair of functions to input and output the TinyXml constructs on the
|
||||
// indicated streams. We could, of course, use the TinyXml output operators,
|
||||
// but this is a smidge more efficient and gives us more control.
|
||||
|
|
|
|||
|
|
@ -33,6 +33,11 @@
|
|||
|
||||
#endif
|
||||
|
||||
using std::istream;
|
||||
using std::ostream;
|
||||
using std::string;
|
||||
using std::wstring;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
|
@ -325,10 +330,10 @@ read_hash(const string &pathname) {
|
|||
#ifdef _WIN32
|
||||
wstring pathname_w;
|
||||
if (string_to_wstring(pathname_w, pathname)) {
|
||||
stream.open(pathname_w.c_str(), ios::in | ios::binary);
|
||||
stream.open(pathname_w.c_str(), std::ios::in | std::ios::binary);
|
||||
}
|
||||
#else // _WIN32
|
||||
stream.open(pathname.c_str(), ios::in | ios::binary);
|
||||
stream.open(pathname.c_str(), std::ios::in | std::ios::binary);
|
||||
#endif // _WIN32
|
||||
|
||||
if (!stream) {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
#include "get_tinyxml.h"
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
/**
|
||||
* This simple class is used both within the core API in this module, as well
|
||||
|
|
|
|||
|
|
@ -27,6 +27,10 @@
|
|||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
using std::cerr;
|
||||
using std::string;
|
||||
using std::wstring;
|
||||
|
||||
#ifdef _WIN32
|
||||
// From KnownFolders.h (part of Vista SDK):
|
||||
#define DEFINE_KNOWN_FOLDER(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
std::string find_root_dir();
|
||||
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ get_osx_home_directory() {
|
|||
/**
|
||||
*
|
||||
*/
|
||||
string
|
||||
std::string
|
||||
find_osx_root_dir() {
|
||||
string result = call_NSSearchPathForDirectories(NSCachesDirectory, NSUserDomainMask);
|
||||
if (!result.empty()) {
|
||||
|
|
|
|||
|
|
@ -28,6 +28,10 @@
|
|||
#include <libio.h>
|
||||
#endif // !_WIN32 && !__APPLE__ && !__FreeBSD__
|
||||
|
||||
using std::cerr;
|
||||
using std::dec;
|
||||
using std::hex;
|
||||
|
||||
static const size_t handle_buffer_size = 4096;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -18,8 +18,6 @@
|
|||
#include "p3d_lock.h"
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@
|
|||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
using std::string;
|
||||
|
||||
#ifdef _WIN32
|
||||
static const string dll_ext = ".dll";
|
||||
#elif defined(__APPLE__)
|
||||
|
|
@ -132,7 +134,7 @@ load_plugin(const string &p3d_plugin_filename,
|
|||
const string &log_directory, const string &log_basename,
|
||||
bool trusted_environment, bool console_environment,
|
||||
const string &root_dir, const string &host_dir,
|
||||
const string &start_dir, ostream &logfile) {
|
||||
const string &start_dir, std::ostream &logfile) {
|
||||
if (plugin_loaded) {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -161,7 +163,7 @@ load_plugin(const string &p3d_plugin_filename,
|
|||
}
|
||||
|
||||
SetErrorMode(0);
|
||||
wstring filename_w;
|
||||
std::wstring filename_w;
|
||||
if (string_to_wstring(filename_w, filename)) {
|
||||
module = LoadLibraryW(filename_w.c_str());
|
||||
}
|
||||
|
|
@ -273,7 +275,7 @@ init_plugin(const string &contents_filename, const string &host_url,
|
|||
const string &log_directory, const string &log_basename,
|
||||
bool trusted_environment, bool console_environment,
|
||||
const string &root_dir, const string &host_dir,
|
||||
const string &start_dir, ostream &logfile) {
|
||||
const string &start_dir, std::ostream &logfile) {
|
||||
|
||||
// Ensure that all of the function pointers have been found.
|
||||
if (P3D_initialize_ptr == nullptr ||
|
||||
|
|
@ -392,7 +394,7 @@ init_plugin(const string &contents_filename, const string &host_url,
|
|||
* the pointers.
|
||||
*/
|
||||
void
|
||||
unload_plugin(ostream &logfile) {
|
||||
unload_plugin(std::ostream &logfile) {
|
||||
if (!plugin_loaded) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
#include "p3d_plugin.h"
|
||||
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
extern P3D_initialize_func *P3D_initialize_ptr;
|
||||
extern P3D_finalize_func *P3D_finalize_ptr;
|
||||
|
|
|
|||
|
|
@ -26,6 +26,10 @@
|
|||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
using std::ostream;
|
||||
using std::string;
|
||||
using std::wstring;
|
||||
|
||||
/**
|
||||
* Returns the directory component of the indicated pathname, or the empty
|
||||
* string if there is no directory prefix.
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
bool mkdir_complete(const std::string &dirname, std::ostream &logfile);
|
||||
bool mkfile_complete(const std::string &dirname, std::ostream &logfile);
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@
|
|||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
using std::string;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
|
@ -178,7 +180,7 @@ start_p3dcert() {
|
|||
nullptr
|
||||
};
|
||||
|
||||
wstring env_w;
|
||||
std::wstring env_w;
|
||||
|
||||
for (int ki = 0; keep[ki] != nullptr; ++ki) {
|
||||
wchar_t *value = _wgetenv(keep[ki]);
|
||||
|
|
@ -369,7 +371,7 @@ win_create_process() {
|
|||
|
||||
// Construct the command-line string, containing the quoted command-line
|
||||
// arguments.
|
||||
ostringstream stream;
|
||||
std::ostringstream stream;
|
||||
stream << "\"" << _p3dcert_exe << "\" \""
|
||||
<< _cert_filename->get_filename() << "\" \"" << _cert_dir << "\"";
|
||||
|
||||
|
|
@ -432,7 +434,7 @@ posix_create_process() {
|
|||
}
|
||||
|
||||
// build up an array of char strings for the environment.
|
||||
vector<const char *> ptrs;
|
||||
std::vector<const char *> ptrs;
|
||||
size_t p = 0;
|
||||
size_t zero = _env.find('\0', p);
|
||||
while (zero != string::npos) {
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ get_int() {
|
|||
* to a string.
|
||||
*/
|
||||
void P3DBoolObject::
|
||||
make_string(string &value) {
|
||||
make_string(std::string &value) {
|
||||
if (_value) {
|
||||
value = "True";
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -46,6 +46,10 @@
|
|||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#endif
|
||||
|
||||
using std::cerr;
|
||||
using std::string;
|
||||
using std::wstring;
|
||||
|
||||
static LanguageIndex li = LI_default;
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@
|
|||
#include <string>
|
||||
#include <iostream>
|
||||
#include <stdio.h>
|
||||
using namespace std;
|
||||
|
||||
class ViewCertDialog;
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@
|
|||
|
||||
#include "ca_bundle_data_src.c"
|
||||
|
||||
using std::cerr;
|
||||
|
||||
static const wxString
|
||||
self_signed_cert_text =
|
||||
_T("This Panda3D application uses a self-signed certificate. ")
|
||||
|
|
@ -132,7 +134,7 @@ END_EVENT_TABLE()
|
|||
*
|
||||
*/
|
||||
AuthDialog::
|
||||
AuthDialog(const string &cert_filename, const string &cert_dir) :
|
||||
AuthDialog(const std::string &cert_filename, const std::string &cert_dir) :
|
||||
// I hate stay-on-top dialogs, but if we don't set this flag, it doesn't
|
||||
// come to the foreground on OSX, and might be lost behind the browser
|
||||
// window.
|
||||
|
|
@ -216,7 +218,7 @@ approve_cert() {
|
|||
size_t buf_length = _cert_dir.length() + 100;
|
||||
char *buf = new char[buf_length];
|
||||
#ifdef _WIN32
|
||||
wstring buf_w;
|
||||
std::wstring buf_w;
|
||||
#endif // _WIN32
|
||||
|
||||
while (true) {
|
||||
|
|
@ -262,10 +264,10 @@ approve_cert() {
|
|||
* line into _cert and _stack.
|
||||
*/
|
||||
void AuthDialog::
|
||||
read_cert_file(const string &cert_filename) {
|
||||
read_cert_file(const std::string &cert_filename) {
|
||||
FILE *fp = nullptr;
|
||||
#ifdef _WIN32
|
||||
wstring cert_filename_w;
|
||||
std::wstring cert_filename_w;
|
||||
if (string_to_wstring(cert_filename_w, cert_filename)) {
|
||||
fp = _wfopen(cert_filename_w.c_str(), L"r");
|
||||
}
|
||||
|
|
@ -612,5 +614,5 @@ layout() {
|
|||
// Make sure the resulting window is at least a certain size.
|
||||
int width, height;
|
||||
GetSize(&width, &height);
|
||||
SetSize(max(width, 600), max(height, 400));
|
||||
SetSize(std::max(width, 600), std::max(height, 400));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@
|
|||
#include <string>
|
||||
#include <iostream>
|
||||
#include <stdio.h>
|
||||
using namespace std;
|
||||
|
||||
class ViewCertDialog;
|
||||
|
||||
|
|
|
|||
|
|
@ -62,8 +62,8 @@ get_bool() {
|
|||
* to a string.
|
||||
*/
|
||||
void P3DConcreteSequence::
|
||||
make_string(string &value) {
|
||||
ostringstream strm;
|
||||
make_string(std::string &value) {
|
||||
std::ostringstream strm;
|
||||
strm << "[";
|
||||
if (!_elements.empty()) {
|
||||
strm << *_elements[0];
|
||||
|
|
@ -81,7 +81,7 @@ make_string(string &value) {
|
|||
* new-reference P3D_object, or NULL on error.
|
||||
*/
|
||||
P3D_object *P3DConcreteSequence::
|
||||
get_property(const string &property) {
|
||||
get_property(const std::string &property) {
|
||||
// We only understand integer "property" names.
|
||||
char *endptr;
|
||||
int index = strtoul(property.c_str(), &endptr, 10);
|
||||
|
|
@ -97,7 +97,7 @@ get_property(const string &property) {
|
|||
* object. Returns true on success, false on failure.
|
||||
*/
|
||||
bool P3DConcreteSequence::
|
||||
set_property(const string &property, P3D_object *value) {
|
||||
set_property(const std::string &property, P3D_object *value) {
|
||||
// We only understand integer "property" names.
|
||||
char *endptr;
|
||||
int index = strtoul(property.c_str(), &endptr, 10);
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
#include "p3dConcreteStruct.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
|
@ -53,7 +55,7 @@ get_bool() {
|
|||
*/
|
||||
void P3DConcreteStruct::
|
||||
make_string(string &value) {
|
||||
ostringstream strm;
|
||||
std::ostringstream strm;
|
||||
strm << "{";
|
||||
if (!_elements.empty()) {
|
||||
Elements::iterator ei;
|
||||
|
|
@ -105,7 +107,7 @@ set_property(const string &property, P3D_object *value) {
|
|||
} else {
|
||||
// Replace or insert an element.
|
||||
P3D_OBJECT_INCREF(value);
|
||||
pair<Elements::iterator, bool> result = _elements.insert(Elements::value_type(property, value));
|
||||
std::pair<Elements::iterator, bool> result = _elements.insert(Elements::value_type(property, value));
|
||||
if (!result.second) {
|
||||
// Replacing an element.
|
||||
Elements::iterator ei = result.first;
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ P3DDownload::
|
|||
* Supplies the source URL for the download.
|
||||
*/
|
||||
void P3DDownload::
|
||||
set_url(const string &url) {
|
||||
set_url(const std::string &url) {
|
||||
_url = url;
|
||||
}
|
||||
|
||||
|
|
@ -119,7 +119,7 @@ feed_url_stream(P3D_result_code result_code,
|
|||
_total_data += this_data_size;
|
||||
}
|
||||
|
||||
total_expected_data = max(total_expected_data, _total_data);
|
||||
total_expected_data = std::max(total_expected_data, _total_data);
|
||||
if (total_expected_data > _total_expected_data) {
|
||||
// If the expected data grows during the download, we don't really know
|
||||
// how much we're getting.
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ P3DFileDownload(const P3DFileDownload ©) :
|
|||
* success, false on failure.
|
||||
*/
|
||||
bool P3DFileDownload::
|
||||
set_filename(const string &filename) {
|
||||
set_filename(const std::string &filename) {
|
||||
_filename = filename;
|
||||
|
||||
return open_file();
|
||||
|
|
@ -57,12 +57,12 @@ open_file() {
|
|||
|
||||
_file.clear();
|
||||
#ifdef _WIN32
|
||||
wstring filename_w;
|
||||
std::wstring filename_w;
|
||||
if (string_to_wstring(filename_w, _filename)) {
|
||||
_file.open(filename_w.c_str(), ios::out | ios::trunc | ios::binary);
|
||||
_file.open(filename_w.c_str(), std::ios::out | std::ios::trunc | std::ios::binary);
|
||||
}
|
||||
#else // _WIN32
|
||||
_file.open(_filename.c_str(), ios::out | ios::trunc | ios::binary);
|
||||
_file.open(_filename.c_str(), std::ios::out | std::ios::trunc | std::ios::binary);
|
||||
#endif // _WIN32
|
||||
if (!_file) {
|
||||
nout << "Failed to open " << _filename << " in write mode\n";
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@
|
|||
#include "p3dFileParams.h"
|
||||
#include <ctype.h>
|
||||
|
||||
using std::string;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -67,8 +67,8 @@ get_float() {
|
|||
* to a string.
|
||||
*/
|
||||
void P3DFloatObject::
|
||||
make_string(string &value) {
|
||||
ostringstream strm;
|
||||
make_string(std::string &value) {
|
||||
std::ostringstream strm;
|
||||
strm << _value;
|
||||
value = strm.str();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,11 @@
|
|||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
using std::ios;
|
||||
using std::ostringstream;
|
||||
using std::string;
|
||||
using std::wstring;
|
||||
|
||||
/**
|
||||
* Use P3DInstanceManager::get_host() to construct a new P3DHost.
|
||||
*/
|
||||
|
|
@ -200,11 +205,11 @@ read_contents_file(const string &contents_filename, bool fresh_download) {
|
|||
_contents_spec.read_hash(contents_filename);
|
||||
}
|
||||
|
||||
_contents_expiration = min(_contents_expiration, (time_t)expiration);
|
||||
_contents_expiration = std::min(_contents_expiration, (time_t)expiration);
|
||||
}
|
||||
|
||||
nout << "read contents.xml, max_age = " << max_age
|
||||
<< ", expires in " << max(_contents_expiration, now) - now
|
||||
<< ", expires in " << std::max(_contents_expiration, now) - now
|
||||
<< " s\n";
|
||||
|
||||
TiXmlElement *xhost = _xcontents->FirstChildElement("host");
|
||||
|
|
@ -631,10 +636,10 @@ migrate_package_host(P3DPackage *package, const string &alt_host, P3DHost *new_h
|
|||
* elements in the list, adds only as many mirrors as we can get.
|
||||
*/
|
||||
void P3DHost::
|
||||
choose_random_mirrors(vector<string> &result, int num_mirrors) {
|
||||
vector<size_t> selected;
|
||||
choose_random_mirrors(std::vector<string> &result, int num_mirrors) {
|
||||
std::vector<size_t> selected;
|
||||
|
||||
size_t num_to_select = min(_mirrors.size(), (size_t)num_mirrors);
|
||||
size_t num_to_select = std::min(_mirrors.size(), (size_t)num_mirrors);
|
||||
while (num_to_select > 0) {
|
||||
size_t i = (size_t)(((double)rand() / (double)RAND_MAX) * _mirrors.size());
|
||||
while (find(selected.begin(), selected.end(), i) != selected.end()) {
|
||||
|
|
@ -846,7 +851,7 @@ copy_file(const string &from_filename, const string &to_filename) {
|
|||
char buffer[buffer_size];
|
||||
|
||||
in.read(buffer, buffer_size);
|
||||
streamsize count = in.gcount();
|
||||
std::streamsize count = in.gcount();
|
||||
while (count != 0) {
|
||||
out.write(buffer, count);
|
||||
if (out.fail()) {
|
||||
|
|
|
|||
|
|
@ -34,6 +34,14 @@
|
|||
#include <sys/mman.h>
|
||||
#include <ApplicationServices/ApplicationServices.h>
|
||||
|
||||
using std::max;
|
||||
using std::min;
|
||||
using std::ostream;
|
||||
using std::ostringstream;
|
||||
using std::stringstream;
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
// Lifted from NSEvent.h (which is Objective-C).
|
||||
enum {
|
||||
NSAlphaShiftKeyMask = 1 << 16,
|
||||
|
|
@ -1472,7 +1480,7 @@ uninstall_host() {
|
|||
uninstall_packages();
|
||||
|
||||
// Collect the set of hosts referenced by this instance.
|
||||
set<P3DHost *> hosts;
|
||||
std::set<P3DHost *> hosts;
|
||||
Packages::const_iterator pi;
|
||||
for (pi = _packages.begin(); pi != _packages.end(); ++pi) {
|
||||
P3DPackage *package = (*pi);
|
||||
|
|
@ -1484,7 +1492,7 @@ uninstall_host() {
|
|||
nout << "Uninstalling " << hosts.size() << " hosts\n";
|
||||
|
||||
// Uninstall all of them.
|
||||
set<P3DHost *>::iterator hi;
|
||||
std::set<P3DHost *>::iterator hi;
|
||||
for (hi = hosts.begin(); hi != hosts.end(); ++hi) {
|
||||
P3DHost *host = (*hi);
|
||||
host->uninstall();
|
||||
|
|
|
|||
|
|
@ -50,8 +50,12 @@
|
|||
|
||||
#include <stdio.h>
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
using std::wstring;
|
||||
|
||||
static ofstream logfile;
|
||||
ostream *nout_stream = &logfile;
|
||||
std::ostream *nout_stream = &logfile;
|
||||
|
||||
P3DInstanceManager *P3DInstanceManager::_global_ptr;
|
||||
|
||||
|
|
@ -285,7 +289,7 @@ initialize(int api_version, const string &contents_filename,
|
|||
if (root_dir.empty()) {
|
||||
_root_dir = find_root_dir();
|
||||
if (_root_dir.empty()) {
|
||||
cerr << "Could not find root directory.\n";
|
||||
std::cerr << "Could not find root directory.\n";
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
|
|
@ -1306,19 +1310,19 @@ append_safe_dir(string &root, const string &basename) {
|
|||
*/
|
||||
void P3DInstanceManager::
|
||||
create_runtime_environment() {
|
||||
mkdir_complete(_log_directory, cerr);
|
||||
mkdir_complete(_log_directory, std::cerr);
|
||||
|
||||
logfile.close();
|
||||
logfile.clear();
|
||||
#ifdef _WIN32
|
||||
wstring log_pathname_w;
|
||||
string_to_wstring(log_pathname_w, _log_pathname);
|
||||
logfile.open(log_pathname_w.c_str(), ios::out | ios::trunc);
|
||||
logfile.open(log_pathname_w.c_str(), std::ios::out | std::ios::trunc);
|
||||
#else
|
||||
logfile.open(_log_pathname.c_str(), ios::out | ios::trunc);
|
||||
logfile.open(_log_pathname.c_str(), std::ios::out | std::ios::trunc);
|
||||
#endif // _WIN32
|
||||
if (logfile) {
|
||||
logfile.setf(ios::unitbuf);
|
||||
logfile.setf(std::ios::unitbuf);
|
||||
nout_stream = &logfile;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -59,8 +59,8 @@ get_int() {
|
|||
* to a string.
|
||||
*/
|
||||
void P3DIntObject::
|
||||
make_string(string &value) {
|
||||
ostringstream strm;
|
||||
make_string(std::string &value) {
|
||||
std::ostringstream strm;
|
||||
strm << _value;
|
||||
value = strm.str();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,11 @@
|
|||
#include "p3dStringObject.h"
|
||||
#include "p3dInstanceManager.h"
|
||||
|
||||
using std::ios;
|
||||
using std::max;
|
||||
using std::streamsize;
|
||||
using std::string;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
|
@ -231,7 +236,7 @@ call(const string &method_name, bool needs_response,
|
|||
* This is intended for developer assistance.
|
||||
*/
|
||||
void P3DMainObject::
|
||||
output(ostream &out) {
|
||||
output(std::ostream &out) {
|
||||
out << "P3DMainObject";
|
||||
}
|
||||
|
||||
|
|
@ -459,7 +464,7 @@ P3D_object *P3DMainObject::
|
|||
read_log(const string &log_pathname, P3D_object *params[], int num_params) {
|
||||
P3DInstanceManager *inst_mgr = P3DInstanceManager::get_global_ptr();
|
||||
string log_directory = inst_mgr->get_log_directory();
|
||||
ostringstream log_data;
|
||||
std::ostringstream log_data;
|
||||
|
||||
// Check the first parameter, if any--if given, it specifies the last n
|
||||
// bytes to retrieve.
|
||||
|
|
@ -512,7 +517,7 @@ read_log(const string &log_pathname, P3D_object *params[], int num_params) {
|
|||
}
|
||||
|
||||
// Read matching files
|
||||
vector<string> all_logs;
|
||||
std::vector<string> all_logs;
|
||||
int log_matches_found = 0;
|
||||
string log_matching_pathname;
|
||||
inst_mgr->scan_directory(log_directory, all_logs);
|
||||
|
|
@ -544,7 +549,7 @@ read_log(const string &log_pathname, P3D_object *params[], int num_params) {
|
|||
void P3DMainObject::
|
||||
read_log_file(const string &log_pathname,
|
||||
size_t tail_bytes, size_t head_bytes,
|
||||
ostringstream &log_data) {
|
||||
std::ostringstream &log_data) {
|
||||
|
||||
// Get leaf name
|
||||
string log_leafname = log_pathname;
|
||||
|
|
|
|||
|
|
@ -23,6 +23,13 @@
|
|||
#include <io.h>
|
||||
#endif
|
||||
|
||||
using std::ios;
|
||||
using std::max;
|
||||
using std::min;
|
||||
using std::streampos;
|
||||
using std::streamsize;
|
||||
using std::string;
|
||||
|
||||
// This sequence of bytes begins each Multifile to identify it as a Multifile.
|
||||
const char P3DMultifileReader::_header[] = "pmf\0\n\r";
|
||||
const size_t P3DMultifileReader::_header_size = 6;
|
||||
|
|
@ -99,7 +106,7 @@ extract_all(const string &to_dir, P3DPackage *package,
|
|||
|
||||
ofstream out;
|
||||
#ifdef _WIN32
|
||||
wstring output_pathname_w;
|
||||
std::wstring output_pathname_w;
|
||||
if (string_to_wstring(output_pathname_w, output_pathname)) {
|
||||
out.open(output_pathname_w.c_str(), ios::out | ios::binary);
|
||||
}
|
||||
|
|
@ -140,7 +147,7 @@ extract_all(const string &to_dir, P3DPackage *package,
|
|||
* stream. Returns true on success, false on failure.
|
||||
*/
|
||||
bool P3DMultifileReader::
|
||||
extract_one(ostream &out, const string &filename) {
|
||||
extract_one(std::ostream &out, const string &filename) {
|
||||
assert(_is_open);
|
||||
if (_in.fail()) {
|
||||
return false;
|
||||
|
|
@ -202,7 +209,7 @@ read_header(const string &pathname) {
|
|||
_signatures.clear();
|
||||
|
||||
#ifdef _WIN32
|
||||
wstring pathname_w;
|
||||
std::wstring pathname_w;
|
||||
if (string_to_wstring(pathname_w, pathname)) {
|
||||
_in.open(pathname_w.c_str(), ios::in | ios::binary);
|
||||
}
|
||||
|
|
@ -341,7 +348,7 @@ read_index() {
|
|||
* Returns true on success, false on failure.
|
||||
*/
|
||||
bool P3DMultifileReader::
|
||||
extract_subfile(ostream &out, const Subfile &s) {
|
||||
extract_subfile(std::ostream &out, const Subfile &s) {
|
||||
_in.seekg(s._data_start + _read_offset);
|
||||
|
||||
static const streamsize buffer_size = 4096;
|
||||
|
|
|
|||
|
|
@ -41,6 +41,6 @@ get_bool() {
|
|||
* to a string.
|
||||
*/
|
||||
void P3DNoneObject::
|
||||
make_string(string &value) {
|
||||
make_string(std::string &value) {
|
||||
value = "None";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@
|
|||
#include "p3dInstanceManager.h"
|
||||
#include <string.h> // strncpy
|
||||
|
||||
using std::string;
|
||||
|
||||
// The following functions are C-style wrappers around the below P3DObject
|
||||
// virtual methods; they are defined to allow us to create the C-style
|
||||
// P3D_class_definition method table to store in the P3D_object structure.
|
||||
|
|
@ -231,7 +233,7 @@ get_string(char *buffer, int buffer_length) {
|
|||
*/
|
||||
int P3DObject::
|
||||
get_repr(char *buffer, int buffer_length) {
|
||||
ostringstream strm;
|
||||
std::ostringstream strm;
|
||||
output(strm);
|
||||
string result = strm.str();
|
||||
strncpy(buffer, result.c_str(), buffer_length);
|
||||
|
|
@ -292,7 +294,7 @@ eval(const string &expression) {
|
|||
* This is intended for developer assistance.
|
||||
*/
|
||||
void P3DObject::
|
||||
output(ostream &out) {
|
||||
output(std::ostream &out) {
|
||||
string value;
|
||||
make_string(value);
|
||||
out << value;
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
using std::string;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
|
@ -580,7 +582,7 @@ paint_image(CGContextRef context, const OsxImageData &image) {
|
|||
// The bitmap is larger than the window; scale it down.
|
||||
double x_scale = (double)_win_width / (double)image._width;
|
||||
double y_scale = (double)_win_height / (double)image._height;
|
||||
double scale = min(x_scale, y_scale);
|
||||
double scale = std::min(x_scale, y_scale);
|
||||
int sc_width = (int)(image._width * scale);
|
||||
int sc_height = (int)(image._height * scale);
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,12 @@
|
|||
#include <io.h> // chmod()
|
||||
#endif
|
||||
|
||||
using std::ios;
|
||||
using std::ostream;
|
||||
using std::ostringstream;
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
// Weight factors for computing download progress. This attempts to reflect
|
||||
// the relative time-per-byte of each of these operations.
|
||||
const double P3DPackage::_download_factor = 1.0;
|
||||
|
|
@ -1147,7 +1153,7 @@ void P3DPackage::
|
|||
report_progress(P3DPackage::InstallStep *step) {
|
||||
if (_computed_plan_size) {
|
||||
double size = _total_plan_completed + _current_step_effort * step->get_progress();
|
||||
_download_progress = min(size / _total_plan_size, 1.0);
|
||||
_download_progress = std::min(size / _total_plan_size, 1.0);
|
||||
|
||||
Instances::iterator ii;
|
||||
for (ii = _instances.begin(); ii != _instances.end(); ++ii) {
|
||||
|
|
@ -1780,7 +1786,7 @@ thread_step() {
|
|||
|
||||
ifstream source;
|
||||
#ifdef _WIN32
|
||||
wstring source_pathname_w;
|
||||
std::wstring source_pathname_w;
|
||||
if (string_to_wstring(source_pathname_w, source_pathname)) {
|
||||
source.open(source_pathname_w.c_str(), ios::in | ios::binary);
|
||||
}
|
||||
|
|
@ -1798,7 +1804,7 @@ thread_step() {
|
|||
|
||||
ofstream target;
|
||||
#ifdef _WIN32
|
||||
wstring target_pathname_w;
|
||||
std::wstring target_pathname_w;
|
||||
if (string_to_wstring(target_pathname_w, target_pathname)) {
|
||||
target.open(target_pathname_w.c_str(), ios::out | ios::binary);
|
||||
}
|
||||
|
|
@ -1829,7 +1835,7 @@ thread_step() {
|
|||
int flush = 0;
|
||||
|
||||
source.read(decompress_buffer, decompress_buffer_size);
|
||||
streamsize read_count = source.gcount();
|
||||
std::streamsize read_count = source.gcount();
|
||||
eof = (read_count == 0 || source.eof() || source.fail());
|
||||
|
||||
z.next_in = (Bytef *)decompress_buffer;
|
||||
|
|
@ -1844,7 +1850,7 @@ thread_step() {
|
|||
while (true) {
|
||||
if (z.avail_in == 0 && !eof) {
|
||||
source.read(decompress_buffer, decompress_buffer_size);
|
||||
streamsize read_count = source.gcount();
|
||||
std::streamsize read_count = source.gcount();
|
||||
eof = (read_count == 0 || source.eof() || source.fail());
|
||||
|
||||
z.next_in = (Bytef *)decompress_buffer;
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
#include "p3dPatchFinder.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
|
@ -116,7 +118,7 @@ operator < (const PackageVersionKey &other) const {
|
|||
*
|
||||
*/
|
||||
void P3DPatchFinder::PackageVersionKey::
|
||||
output(ostream &out) const {
|
||||
output(std::ostream &out) const {
|
||||
out << "(" << _package_name << ", " << _platform << ", " << _version
|
||||
<< ", " << _host_url << ", ";
|
||||
_file.output_hash(out);
|
||||
|
|
|
|||
|
|
@ -14,6 +14,9 @@
|
|||
#include "p3dPatchfileReader.h"
|
||||
#include "wstring_encode.h"
|
||||
|
||||
using std::ios;
|
||||
using std::string;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
|
@ -55,7 +58,7 @@ open_read() {
|
|||
string patch_pathname = _patchfile.get_pathname(_package_dir);
|
||||
_patch_in.clear();
|
||||
#ifdef _WIN32
|
||||
wstring patch_pathname_w;
|
||||
std::wstring patch_pathname_w;
|
||||
if (string_to_wstring(patch_pathname_w, patch_pathname)) {
|
||||
_patch_in.open(patch_pathname_w.c_str(), ios::in | ios::binary);
|
||||
}
|
||||
|
|
@ -66,7 +69,7 @@ open_read() {
|
|||
string source_pathname = _source.get_pathname(_package_dir);
|
||||
_source_in.clear();
|
||||
#ifdef _WIN32
|
||||
wstring source_pathname_w;
|
||||
std::wstring source_pathname_w;
|
||||
if (string_to_wstring(source_pathname_w, source_pathname)) {
|
||||
_source_in.open(source_pathname_w.c_str(), ios::in | ios::binary);
|
||||
}
|
||||
|
|
@ -77,7 +80,7 @@ open_read() {
|
|||
mkfile_complete(_output_pathname, nout);
|
||||
_target_out.clear();
|
||||
#ifdef _WIN32
|
||||
wstring output_pathname_w;
|
||||
std::wstring output_pathname_w;
|
||||
if (string_to_wstring(output_pathname_w, _output_pathname)) {
|
||||
_target_out.open(output_pathname_w.c_str(), ios::in | ios::binary);
|
||||
}
|
||||
|
|
@ -247,13 +250,13 @@ close() {
|
|||
* have enough bytes.
|
||||
*/
|
||||
bool P3DPatchfileReader::
|
||||
copy_bytes(istream &in, size_t copy_byte_count) {
|
||||
copy_bytes(std::istream &in, size_t copy_byte_count) {
|
||||
static const size_t buffer_size = 8192;
|
||||
char buffer[buffer_size];
|
||||
|
||||
streamsize read_size = min(copy_byte_count, buffer_size);
|
||||
std::streamsize read_size = std::min(copy_byte_count, buffer_size);
|
||||
in.read(buffer, read_size);
|
||||
streamsize count = in.gcount();
|
||||
std::streamsize count = in.gcount();
|
||||
while (count != 0) {
|
||||
_target_out.write(buffer, count);
|
||||
_bytes_written += (size_t)count;
|
||||
|
|
@ -267,7 +270,7 @@ copy_bytes(istream &in, size_t copy_byte_count) {
|
|||
copy_byte_count -= (size_t)count;
|
||||
count = 0;
|
||||
if (copy_byte_count != 0) {
|
||||
read_size = min(copy_byte_count, buffer_size);
|
||||
read_size = std::min(copy_byte_count, buffer_size);
|
||||
in.read(buffer, read_size);
|
||||
count = in.gcount();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
#include <vector>
|
||||
#include <assert.h>
|
||||
#include <string.h> // strrchr
|
||||
using namespace std;
|
||||
|
||||
#if defined(_WIN32) && defined(NON_CONSOLE)
|
||||
// On Windows, we may need to build p3dpythonw.exe, a non-console version of
|
||||
|
|
@ -34,7 +33,7 @@ static char *
|
|||
parse_quoted_arg(char *&p) {
|
||||
char quote = *p;
|
||||
++p;
|
||||
string result;
|
||||
std::string result;
|
||||
|
||||
while (*p != '\0' && *p != quote) {
|
||||
// TODO: handle escape characters? Not sure if we need to.
|
||||
|
|
@ -51,7 +50,7 @@ parse_quoted_arg(char *&p) {
|
|||
// beginning at p. Advances p to the first whitespace following the argument.
|
||||
static char *
|
||||
parse_unquoted_arg(char *&p) {
|
||||
string result;
|
||||
std::string result;
|
||||
while (*p != '\0' && !isspace(*p)) {
|
||||
result += *p;
|
||||
++p;
|
||||
|
|
@ -63,7 +62,7 @@ int WINAPI
|
|||
WinMain(HINSTANCE, HINSTANCE, LPSTR, int) {
|
||||
char *command_line = GetCommandLine();
|
||||
|
||||
vector<char *> argv;
|
||||
std::vector<char *> argv;
|
||||
|
||||
char *p = command_line;
|
||||
while (*p != '\0') {
|
||||
|
|
@ -113,13 +112,13 @@ main(int argc, char *argv[]) {
|
|||
}
|
||||
|
||||
if (archive_file == nullptr || *archive_file == '\0') {
|
||||
cerr << "No archive filename specified on command line.\n";
|
||||
std::cerr << "No archive filename specified on command line.\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
FHandle input_handle = invalid_fhandle;
|
||||
if (input_handle_str != nullptr && *input_handle_str) {
|
||||
stringstream stream(input_handle_str);
|
||||
std::stringstream stream(input_handle_str);
|
||||
stream >> input_handle;
|
||||
if (!stream) {
|
||||
input_handle = invalid_fhandle;
|
||||
|
|
@ -128,7 +127,7 @@ main(int argc, char *argv[]) {
|
|||
|
||||
FHandle output_handle = invalid_fhandle;
|
||||
if (output_handle_str != nullptr && *output_handle_str) {
|
||||
stringstream stream(output_handle_str);
|
||||
std::stringstream stream(output_handle_str);
|
||||
stream >> output_handle;
|
||||
if (!stream) {
|
||||
output_handle = invalid_fhandle;
|
||||
|
|
@ -137,7 +136,7 @@ main(int argc, char *argv[]) {
|
|||
|
||||
bool interactive_console = false;
|
||||
if (interactive_console_str != nullptr && *interactive_console_str) {
|
||||
stringstream stream(interactive_console_str);
|
||||
std::stringstream stream(interactive_console_str);
|
||||
int flag;
|
||||
stream >> flag;
|
||||
if (!stream.fail()) {
|
||||
|
|
@ -148,7 +147,7 @@ main(int argc, char *argv[]) {
|
|||
int status = run_p3dpython(program_name, archive_file, input_handle,
|
||||
output_handle, nullptr, interactive_console);
|
||||
if (status != 0) {
|
||||
cerr << "Failure on startup.\n";
|
||||
std::cerr << "Failure on startup.\n";
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
#include "p3dPythonObject.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
|
@ -178,7 +180,7 @@ set_property_insecure(const string &property, bool needs_response,
|
|||
bool P3DPythonObject::
|
||||
has_method(const string &method_name) {
|
||||
// First, check the cache.
|
||||
pair<HasMethod::iterator, bool> cresult = _has_method.insert(HasMethod::value_type(method_name, false));
|
||||
std::pair<HasMethod::iterator, bool> cresult = _has_method.insert(HasMethod::value_type(method_name, false));
|
||||
HasMethod::iterator hi = cresult.first;
|
||||
if (!cresult.second) {
|
||||
// Already cached.
|
||||
|
|
@ -281,7 +283,7 @@ call_insecure(const string &method_name, bool needs_response,
|
|||
* This is intended for developer assistance.
|
||||
*/
|
||||
void P3DPythonObject::
|
||||
output(ostream &out) {
|
||||
output(std::ostream &out) {
|
||||
P3D_object *result = call("__repr__", true, nullptr, 0);
|
||||
out << "Python " << _object_id;
|
||||
if (result != nullptr) {
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@
|
|||
|
||||
#include "py_panda.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
extern "C" {
|
||||
// This has been compiled-in by the build system, if all is well.
|
||||
extern struct _frozen _PyImport_FrozenModules[];
|
||||
|
|
@ -118,7 +120,7 @@ P3DPythonRun(const char *program_name, const char *archive_file,
|
|||
f.set_text();
|
||||
if (f.open_write(_error_log)) {
|
||||
// Set up the indicated error log as the Notify output.
|
||||
_error_log.setf(ios::unitbuf);
|
||||
_error_log.setf(std::ios::unitbuf);
|
||||
Notify::ptr()->set_ostream_ptr(&_error_log, false);
|
||||
}
|
||||
}
|
||||
|
|
@ -155,7 +157,7 @@ P3DPythonRun::
|
|||
|
||||
// Restore the notify stream in case it tries to write to anything else
|
||||
// after our shutdown.
|
||||
Notify::ptr()->set_ostream_ptr(&cerr, false);
|
||||
Notify::ptr()->set_ostream_ptr(&std::cerr, false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1439,7 +1441,7 @@ setup_window(P3DCInstance *inst, TiXmlElement *xwparams) {
|
|||
const char *parent_cstr = xwparams->Attribute("parent_xwindow");
|
||||
if (parent_cstr != nullptr) {
|
||||
long window;
|
||||
istringstream strm(parent_cstr);
|
||||
std::istringstream strm(parent_cstr);
|
||||
strm >> window;
|
||||
parent_window_handle = NativeWindowHandle::make_x11((X11_Window)window);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,8 +41,6 @@ typedef int Py_ssize_t;
|
|||
#define PY_SSIZE_T_MIN INT_MIN
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
|
||||
/**
|
||||
* This class is used to run, and communicate with, embedded Python in a sub-
|
||||
* process. It is compiled and launched as a separate executable from the
|
||||
|
|
|
|||
|
|
@ -43,6 +43,9 @@
|
|||
#include <crt_externs.h>
|
||||
#endif
|
||||
|
||||
using std::string;
|
||||
using std::wstring;
|
||||
|
||||
/**
|
||||
* Creates a new session, corresponding to a new subprocess with its own copy
|
||||
* of Python. The initial parameters for the session are taken from the
|
||||
|
|
@ -1047,7 +1050,7 @@ start_p3dpython(P3DInstance *inst) {
|
|||
// Check if we want to keep copies of recent logs on disk.
|
||||
if (!log_basename.empty()) {
|
||||
// Get a list of all logs on disk
|
||||
vector<string> all_logs;
|
||||
std::vector<string> all_logs;
|
||||
string log_directory = inst_mgr->get_log_directory();
|
||||
inst_mgr->scan_directory(log_directory, all_logs);
|
||||
|
||||
|
|
@ -1067,7 +1070,7 @@ start_p3dpython(P3DInstance *inst) {
|
|||
// Remove all but the most recent log_history timestamped logs
|
||||
string log_basename_dash = (log_basename + string("-"));
|
||||
string log_matching_pathname;
|
||||
vector<string> matching_logs;
|
||||
std::vector<string> matching_logs;
|
||||
for (int i=0; i<(int)all_logs.size(); ++i) {
|
||||
if ((all_logs[i].size() > 4) &&
|
||||
(all_logs[i].find(log_basename_dash) == 0) &&
|
||||
|
|
@ -1457,7 +1460,7 @@ win_create_process() {
|
|||
|
||||
// Construct the command-line string, containing the quoted command-line
|
||||
// arguments.
|
||||
ostringstream stream;
|
||||
std::ostringstream stream;
|
||||
stream << "\"" << _p3dpython_exe << "\" \"" << _mf_filename
|
||||
<< "\" \"" << _input_handle << "\" \"" << _output_handle
|
||||
<< "\" \"" << _interactive_console << "\"";
|
||||
|
|
@ -1569,7 +1572,7 @@ posix_create_process() {
|
|||
}
|
||||
|
||||
// build up an array of char strings for the environment.
|
||||
vector<const char *> ptrs;
|
||||
std::vector<const char *> ptrs;
|
||||
size_t p = 0;
|
||||
size_t zero = _env.find('\0', p);
|
||||
while (zero != string::npos) {
|
||||
|
|
@ -1579,11 +1582,11 @@ posix_create_process() {
|
|||
}
|
||||
ptrs.push_back(nullptr);
|
||||
|
||||
stringstream input_handle_stream;
|
||||
std::stringstream input_handle_stream;
|
||||
input_handle_stream << _input_handle;
|
||||
string input_handle_str = input_handle_stream.str();
|
||||
|
||||
stringstream output_handle_stream;
|
||||
std::stringstream output_handle_stream;
|
||||
output_handle_stream << _output_handle;
|
||||
string output_handle_str = output_handle_stream.str();
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,10 @@
|
|||
#define STB_IMAGE_IMPLEMENTATION
|
||||
#include "stb_image.h"
|
||||
|
||||
using std::max;
|
||||
using std::min;
|
||||
using std::string;
|
||||
|
||||
// The number of pixels to move the block per byte downloaded, when we don't
|
||||
// know the actual file size we're downloading.
|
||||
const double P3DSplashWindow::_unknown_progress_rate = 1.0 / 4096;
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue