diff --git a/contrib/src/ai/aiBehaviors.cxx b/contrib/src/ai/aiBehaviors.cxx index 38d32b1026..1ace436e5b 100644 --- a/contrib/src/ai/aiBehaviors.cxx +++ b/contrib/src/ai/aiBehaviors.cxx @@ -13,6 +13,10 @@ #include "aiBehaviors.h" +using std::cout; +using std::endl; +using std::string; + static const float _PI = 3.14; AIBehaviors::AIBehaviors() { diff --git a/contrib/src/ai/aiCharacter.cxx b/contrib/src/ai/aiCharacter.cxx index 240f1a4ea3..58485081c3 100644 --- a/contrib/src/ai/aiCharacter.cxx +++ b/contrib/src/ai/aiCharacter.cxx @@ -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; diff --git a/contrib/src/ai/aiPathFinder.cxx b/contrib/src/ai/aiPathFinder.cxx index 8167a6e42e..be2b2dd56a 100644 --- a/contrib/src/ai/aiPathFinder.cxx +++ b/contrib/src/ai/aiPathFinder.cxx @@ -74,7 +74,7 @@ void PathFinder::generate_path() { add_to_clist(nxt_node); } } - cout<<"DESTINATION NOT REACHABLE MATE!"<_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; } } diff --git a/contrib/src/ai/arrival.cxx b/contrib/src/ai/arrival.cxx index af7400d170..966a6b2611 100644 --- a/contrib/src/ai/arrival.cxx +++ b/contrib/src/ai/arrival.cxx @@ -77,7 +77,7 @@ LVecBase3 Arrival::do_arrival() { return(desired_force); } - cout<<"Arrival works only with seek and pursue"< 0) { diff --git a/contrib/src/rplight/gpuCommand.cxx b/contrib/src/rplight/gpuCommand.cxx index 2bd468c902..0b977bc5bb 100644 --- a/contrib/src/rplight/gpuCommand.cxx +++ b/contrib/src/rplight/gpuCommand.cxx @@ -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; } /** diff --git a/contrib/src/rplight/iesDataset.cxx b/contrib/src/rplight/iesDataset.cxx index 34f5a8608e..9aafbf2f86 100644 --- a/contrib/src/rplight/iesDataset.cxx +++ b/contrib/src/rplight/iesDataset.cxx @@ -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); diff --git a/contrib/src/rplight/internalLightManager.cxx b/contrib/src/rplight/internalLightManager.cxx index ea45c518fd..3d80294f82 100644 --- a/contrib/src/rplight/internalLightManager.cxx +++ b/contrib/src/rplight/internalLightManager.cxx @@ -29,6 +29,8 @@ #include +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 sources_to_update; + std::vector 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()) { diff --git a/contrib/src/rplight/shadowAtlas.cxx b/contrib/src/rplight/shadowAtlas.cxx index 15d4ea1bd0..fa2b2d3076 100644 --- a/contrib/src/rplight/shadowAtlas.cxx +++ b/contrib/src/rplight/shadowAtlas.cxx @@ -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); } diff --git a/contrib/src/rplight/tagStateManager.cxx b/contrib/src/rplight/tagStateManager.cxx index ddc996f9a4..30653d1f79 100644 --- a/contrib/src/rplight/tagStateManager.cxx +++ b/contrib/src/rplight/tagStateManager.cxx @@ -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; diff --git a/direct/src/dcparse/dcparse.cxx b/direct/src/dcparse/dcparse.cxx index 9fbd4ef063..b12323bb4a 100644 --- a/direct/src/dcparse/dcparse.cxx +++ b/direct/src/dcparse/dcparse.cxx @@ -19,6 +19,9 @@ #include "indent.h" #include "panda_getopt.h" +using std::cerr; +using std::cout; + void usage() { cerr << diff --git a/direct/src/dcparser/dcArrayParameter.cxx b/direct/src/dcparser/dcArrayParameter.cxx index b8101128bd..2f2ea69932 100644 --- a/direct/src/dcparser/dcArrayParameter.cxx +++ b/direct/src/dcparser/dcArrayParameter.cxx @@ -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); diff --git a/direct/src/dcparser/dcAtomicField.cxx b/direct/src/dcparser/dcAtomicField.cxx index c3f0dc365b..3efebfa2d6 100644 --- a/direct/src/dcparser/dcAtomicField.cxx +++ b/direct/src/dcparser/dcAtomicField.cxx @@ -19,6 +19,8 @@ #include +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()) { diff --git a/direct/src/dcparser/dcClass.cxx b/direct/src/dcparser/dcClass.cxx index 3d311e6506..4c428db595 100644 --- a/direct/src/dcparser/dcClass.cxx +++ b/direct/src/dcparser/dcClass.cxx @@ -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; } diff --git a/direct/src/dcparser/dcClassParameter.cxx b/direct/src/dcparser/dcClassParameter.cxx index 379dbb5961..a3bc68d5eb 100644 --- a/direct/src/dcparser/dcClassParameter.cxx +++ b/direct/src/dcparser/dcClassParameter.cxx @@ -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); diff --git a/direct/src/dcparser/dcDeclaration.cxx b/direct/src/dcparser/dcDeclaration.cxx index 7da467a44a..bf8830f046 100644 --- a/direct/src/dcparser/dcDeclaration.cxx +++ b/direct/src/dcparser/dcDeclaration.cxx @@ -57,7 +57,7 @@ as_switch() const { * Write a string representation of this instance to . */ 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 . */ void DCDeclaration:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { write(out, false, indent_level); } diff --git a/direct/src/dcparser/dcField.cxx b/direct/src/dcparser/dcField.cxx index eeace485c6..4f255dea7d 100644 --- a/direct/src/dcparser/dcField.cxx +++ b/direct/src/dcparser/dcField.cxx @@ -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()); } diff --git a/direct/src/dcparser/dcFile.cxx b/direct/src/dcparser/dcFile.cxx index 43301e4615..be69b4b18c 100644 --- a/direct/src/dcparser/dcFile.cxx +++ b/direct/src/dcparser/dcFile.cxx @@ -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) { diff --git a/direct/src/dcparser/dcKeyword.cxx b/direct/src/dcparser/dcKeyword.cxx index 17dcab8df2..ef9c497b7d 100644 --- a/direct/src/dcparser/dcKeyword.cxx +++ b/direct/src/dcparser/dcKeyword.cxx @@ -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 . */ 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"; } diff --git a/direct/src/dcparser/dcKeywordList.cxx b/direct/src/dcparser/dcKeywordList.cxx index c2cba110b6..cdfdd4f7f5 100644 --- a/direct/src/dcparser/dcKeywordList.cxx +++ b/direct/src/dcparser/dcKeywordList.cxx @@ -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(); diff --git a/direct/src/dcparser/dcLexer.cxx.prebuilt b/direct/src/dcparser/dcLexer.cxx.prebuilt index f99b920f81..70333927fe 100644 --- a/direct/src/dcparser/dcLexer.cxx.prebuilt +++ b/direct/src/dcparser/dcLexer.cxx.prebuilt @@ -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; diff --git a/direct/src/dcparser/dcLexer.lxx b/direct/src/dcparser/dcLexer.lxx index b2d83dad47..423bfe9a99 100644 --- a/direct/src/dcparser/dcLexer.lxx +++ b/direct/src/dcparser/dcLexer.lxx @@ -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; diff --git a/direct/src/dcparser/dcMolecularField.cxx b/direct/src/dcparser/dcMolecularField.cxx index 178c86ad2e..b5e18094a9 100644 --- a/direct/src/dcparser/dcMolecularField.cxx +++ b/direct/src/dcparser/dcMolecularField.cxx @@ -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) { diff --git a/direct/src/dcparser/dcPacker.cxx b/direct/src/dcparser/dcPacker.cxx index 119add847e..ebab348f6f 100644 --- a/direct/src/dcparser/dcPacker.cxx +++ b/direct/src/dcparser/dcPacker.cxx @@ -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; diff --git a/direct/src/dcparser/dcPackerCatalog.cxx b/direct/src/dcparser/dcPackerCatalog.cxx index 0eda4197b6..594c7b6742 100644 --- a/direct/src/dcparser/dcPackerCatalog.cxx +++ b/direct/src/dcparser/dcPackerCatalog.cxx @@ -16,6 +16,8 @@ #include "dcPacker.h" #include "dcSwitchParameter.h" +using std::string; + /** * The catalog is created only by DCPackerInterface::get_catalog(). */ diff --git a/direct/src/dcparser/dcPackerInterface.cxx b/direct/src/dcparser/dcPackerInterface.cxx index dd6e4ae482..d17ff1f7b7 100644 --- a/direct/src/dcparser/dcPackerInterface.cxx +++ b/direct/src/dcparser/dcPackerInterface.cxx @@ -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(); diff --git a/direct/src/dcparser/dcParameter.cxx b/direct/src/dcparser/dcParameter.cxx index ef1c50997f..61b13ff04a 100644 --- a/direct/src/dcparser/dcParameter.cxx +++ b/direct/src/dcparser/dcParameter.cxx @@ -17,6 +17,9 @@ #include "dcindent.h" #include "dcTypedef.h" +using std::ostream; +using std::string; + /** * */ diff --git a/direct/src/dcparser/dcParser.cxx.prebuilt b/direct/src/dcparser/dcParser.cxx.prebuilt index a7f911e452..80df4b2b09 100644 --- a/direct/src/dcparser/dcParser.cxx.prebuilt +++ b/direct/src/dcparser/dcParser.cxx.prebuilt @@ -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; diff --git a/direct/src/dcparser/dcParser.yxx b/direct/src/dcparser/dcParser.yxx index 8b9c7e40ad..0a5c3d6aa0 100644 --- a/direct/src/dcparser/dcParser.yxx +++ b/direct/src/dcparser/dcParser.yxx @@ -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; diff --git a/direct/src/dcparser/dcSimpleParameter.cxx b/direct/src/dcparser/dcSimpleParameter.cxx index 34f4e7e402..bd2cb05534 100644 --- a/direct/src/dcparser/dcSimpleParameter.cxx +++ b/direct/src/dcparser/dcSimpleParameter.cxx @@ -20,6 +20,8 @@ #include "hashGenerator.h" #include +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); diff --git a/direct/src/dcparser/dcSubatomicType.cxx b/direct/src/dcparser/dcSubatomicType.cxx index 1489fe3a3f..841edf7155 100644 --- a/direct/src/dcparser/dcSubatomicType.cxx +++ b/direct/src/dcparser/dcSubatomicType.cxx @@ -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"; diff --git a/direct/src/dcparser/dcSwitch.cxx b/direct/src/dcparser/dcSwitch.cxx index ee3c70f7c5..5b23505209 100644 --- a/direct/src/dcparser/dcSwitch.cxx +++ b/direct/src/dcparser/dcSwitch.cxx @@ -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. diff --git a/direct/src/dcparser/dcSwitchParameter.cxx b/direct/src/dcparser/dcSwitchParameter.cxx index 8f3b7ccf00..d4f2c10394 100644 --- a/direct/src/dcparser/dcSwitchParameter.cxx +++ b/direct/src/dcparser/dcSwitchParameter.cxx @@ -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) { diff --git a/direct/src/dcparser/dcTypedef.cxx b/direct/src/dcparser/dcTypedef.cxx index cc45f74d49..a83f68e895 100644 --- a/direct/src/dcparser/dcTypedef.cxx +++ b/direct/src/dcparser/dcTypedef.cxx @@ -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 . */ 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 "; diff --git a/direct/src/dcparser/dcindent.cxx b/direct/src/dcparser/dcindent.cxx index ae466667ac..b7b9f20793 100644 --- a/direct/src/dcparser/dcindent.cxx +++ b/direct/src/dcparser/dcindent.cxx @@ -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 << ' '; } diff --git a/direct/src/dcparser/hashGenerator.cxx b/direct/src/dcparser/hashGenerator.cxx index b5a092f95c..900fd4bf42 100644 --- a/direct/src/dcparser/hashGenerator.cxx +++ b/direct/src/dcparser/hashGenerator.cxx @@ -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); } diff --git a/direct/src/deadrec/smoothMover.cxx b/direct/src/deadrec/smoothMover.cxx index 727f10f9b3..d15ad745c6 100644 --- a/direct/src/deadrec/smoothMover.cxx +++ b/direct/src/deadrec/smoothMover.cxx @@ -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++) { diff --git a/direct/src/directd/directd.cxx b/direct/src/directd/directd.cxx index 027236579d..817706acb5 100644 --- a/direct/src/directd/directd.cxx +++ b/direct/src/directd/directd.cxx @@ -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<<"!"<= 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; diff --git a/direct/src/distributed/cDistributedSmoothNodeBase.cxx b/direct/src/distributed/cDistributedSmoothNodeBase.cxx index 37c69daaca..67e273644f 100644 --- a/direct/src/distributed/cDistributedSmoothNodeBase.cxx +++ b/direct/src/distributed/cDistributedSmoothNodeBase.cxx @@ -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"; } diff --git a/direct/src/interval/cConstrainHprInterval.cxx b/direct/src/interval/cConstrainHprInterval.cxx index bfd6f6d86d..0cd3e26a35 100644 --- a/direct/src/interval/cConstrainHprInterval.cxx +++ b/direct/src/interval/cConstrainHprInterval.cxx @@ -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(); } diff --git a/direct/src/interval/cConstrainPosHprInterval.cxx b/direct/src/interval/cConstrainPosHprInterval.cxx index 7b0944c3e4..4e30d9f56e 100644 --- a/direct/src/interval/cConstrainPosHprInterval.cxx +++ b/direct/src/interval/cConstrainPosHprInterval.cxx @@ -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(); } diff --git a/direct/src/interval/cConstrainPosInterval.cxx b/direct/src/interval/cConstrainPosInterval.cxx index fe8f235654..1cc967617c 100644 --- a/direct/src/interval/cConstrainPosInterval.cxx +++ b/direct/src/interval/cConstrainPosInterval.cxx @@ -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(); } diff --git a/direct/src/interval/cConstrainTransformInterval.cxx b/direct/src/interval/cConstrainTransformInterval.cxx index f816f3bbc1..a21c109bde 100644 --- a/direct/src/interval/cConstrainTransformInterval.cxx +++ b/direct/src/interval/cConstrainTransformInterval.cxx @@ -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(); } diff --git a/direct/src/interval/cConstraintInterval.cxx b/direct/src/interval/cConstraintInterval.cxx index 708caed9fa..71ac457cb4 100644 --- a/direct/src/interval/cConstraintInterval.cxx +++ b/direct/src/interval/cConstraintInterval.cxx @@ -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) { } diff --git a/direct/src/interval/cInterval.cxx b/direct/src/interval/cInterval.cxx index 84325720ab..0e7dba1554 100644 --- a/direct/src/interval/cInterval.cxx +++ b/direct/src/interval/cInterval.cxx @@ -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) diff --git a/direct/src/interval/cIntervalManager.cxx b/direct/src/interval/cIntervalManager.cxx index 104c9e0953..137f30c0ff 100644 --- a/direct/src/interval/cIntervalManager.cxx +++ b/direct/src/interval/cIntervalManager.cxx @@ -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 diff --git a/direct/src/interval/cLerpAnimEffectInterval.cxx b/direct/src/interval/cLerpAnimEffectInterval.cxx index d91bf8612e..4f7986a7c4 100644 --- a/direct/src/interval/cLerpAnimEffectInterval.cxx +++ b/direct/src/interval/cLerpAnimEffectInterval.cxx @@ -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()) { diff --git a/direct/src/interval/cLerpInterval.cxx b/direct/src/interval/cLerpInterval.cxx index b1eec3a135..43a291f94e 100644 --- a/direct/src/interval/cLerpInterval.cxx +++ b/direct/src/interval/cLerpInterval.cxx @@ -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: diff --git a/direct/src/interval/cLerpNodePathInterval.cxx b/direct/src/interval/cLerpNodePathInterval.cxx index 12286ce3d8..2fbc8a7e75 100644 --- a/direct/src/interval/cLerpNodePathInterval.cxx +++ b/direct/src/interval/cLerpNodePathInterval.cxx @@ -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) { diff --git a/direct/src/interval/cMetaInterval.cxx b/direct/src/interval/cMetaInterval.cxx index 2b764187bc..d43ea9cebf 100644 --- a/direct/src/interval/cMetaInterval.cxx +++ b/direct/src/interval/cMetaInterval.cxx @@ -21,6 +21,8 @@ #include // for log10() #include // 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: diff --git a/direct/src/interval/hideInterval.cxx b/direct/src/interval/hideInterval.cxx index ed335dc307..46498800e0 100644 --- a/direct/src/interval/hideInterval.cxx +++ b/direct/src/interval/hideInterval.cxx @@ -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(); diff --git a/direct/src/interval/showInterval.cxx b/direct/src/interval/showInterval.cxx index 53bc7d2346..b014100f2f 100644 --- a/direct/src/interval/showInterval.cxx +++ b/direct/src/interval/showInterval.cxx @@ -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(); diff --git a/direct/src/plugin/binaryXml.cxx b/direct/src/plugin/binaryXml.cxx index 4840a2c1e2..7dc4a60268 100644 --- a/direct/src/plugin/binaryXml.cxx +++ b/direct/src/plugin/binaryXml.cxx @@ -15,6 +15,11 @@ #include "p3d_lock.h" #include +using std::istream; +using std::ostream; +using std::ostringstream; +using std::string; + static const bool debug_xml_output = false; static LOCK xml_lock; diff --git a/direct/src/plugin/binaryXml.h b/direct/src/plugin/binaryXml.h index 664c7fb5e6..477c51e83f 100644 --- a/direct/src/plugin/binaryXml.h +++ b/direct/src/plugin/binaryXml.h @@ -18,8 +18,6 @@ #include "handleStream.h" #include -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. diff --git a/direct/src/plugin/fileSpec.cxx b/direct/src/plugin/fileSpec.cxx index 29f22e9899..c291bfc14a 100644 --- a/direct/src/plugin/fileSpec.cxx +++ b/direct/src/plugin/fileSpec.cxx @@ -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) { diff --git a/direct/src/plugin/fileSpec.h b/direct/src/plugin/fileSpec.h index e393b680fa..3a661ab603 100644 --- a/direct/src/plugin/fileSpec.h +++ b/direct/src/plugin/fileSpec.h @@ -16,7 +16,6 @@ #include "get_tinyxml.h" #include -using namespace std; /** * This simple class is used both within the core API in this module, as well diff --git a/direct/src/plugin/find_root_dir.cxx b/direct/src/plugin/find_root_dir.cxx index d15362bfd0..7d20461aa9 100644 --- a/direct/src/plugin/find_root_dir.cxx +++ b/direct/src/plugin/find_root_dir.cxx @@ -27,6 +27,10 @@ #include #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) \ diff --git a/direct/src/plugin/find_root_dir.h b/direct/src/plugin/find_root_dir.h index 977a64cc37..e76be59af3 100644 --- a/direct/src/plugin/find_root_dir.h +++ b/direct/src/plugin/find_root_dir.h @@ -16,7 +16,6 @@ #include #include -using namespace std; std::string find_root_dir(); diff --git a/direct/src/plugin/find_root_dir_assist.mm b/direct/src/plugin/find_root_dir_assist.mm index e4eed157a6..f27693d147 100644 --- a/direct/src/plugin/find_root_dir_assist.mm +++ b/direct/src/plugin/find_root_dir_assist.mm @@ -70,7 +70,7 @@ get_osx_home_directory() { /** * */ -string +std::string find_osx_root_dir() { string result = call_NSSearchPathForDirectories(NSCachesDirectory, NSUserDomainMask); if (!result.empty()) { diff --git a/direct/src/plugin/handleStreamBuf.cxx b/direct/src/plugin/handleStreamBuf.cxx index c2adbd2f62..55e74977b5 100644 --- a/direct/src/plugin/handleStreamBuf.cxx +++ b/direct/src/plugin/handleStreamBuf.cxx @@ -28,6 +28,10 @@ #include #endif // !_WIN32 && !__APPLE__ && !__FreeBSD__ +using std::cerr; +using std::dec; +using std::hex; + static const size_t handle_buffer_size = 4096; /** diff --git a/direct/src/plugin/handleStreamBuf.h b/direct/src/plugin/handleStreamBuf.h index 19610a0c45..da3448d4d3 100644 --- a/direct/src/plugin/handleStreamBuf.h +++ b/direct/src/plugin/handleStreamBuf.h @@ -18,8 +18,6 @@ #include "p3d_lock.h" #include -using namespace std; - /** * */ diff --git a/direct/src/plugin/load_plugin.cxx b/direct/src/plugin/load_plugin.cxx index f46cb7355d..75def4fc10 100644 --- a/direct/src/plugin/load_plugin.cxx +++ b/direct/src/plugin/load_plugin.cxx @@ -24,6 +24,8 @@ #include #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; } diff --git a/direct/src/plugin/load_plugin.h b/direct/src/plugin/load_plugin.h index 58f160ef7d..2e462ed9cd 100644 --- a/direct/src/plugin/load_plugin.h +++ b/direct/src/plugin/load_plugin.h @@ -17,7 +17,6 @@ #include "p3d_plugin.h" #include -using namespace std; extern P3D_initialize_func *P3D_initialize_ptr; extern P3D_finalize_func *P3D_finalize_ptr; diff --git a/direct/src/plugin/mkdir_complete.cxx b/direct/src/plugin/mkdir_complete.cxx index 8b721f1fa8..6689584198 100644 --- a/direct/src/plugin/mkdir_complete.cxx +++ b/direct/src/plugin/mkdir_complete.cxx @@ -26,6 +26,10 @@ #include #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. diff --git a/direct/src/plugin/mkdir_complete.h b/direct/src/plugin/mkdir_complete.h index 5ba165e6be..be79cf7e8e 100644 --- a/direct/src/plugin/mkdir_complete.h +++ b/direct/src/plugin/mkdir_complete.h @@ -16,7 +16,6 @@ #include #include -using namespace std; bool mkdir_complete(const std::string &dirname, std::ostream &logfile); bool mkfile_complete(const std::string &dirname, std::ostream &logfile); diff --git a/direct/src/plugin/p3dAuthSession.cxx b/direct/src/plugin/p3dAuthSession.cxx index 15363647f9..e76bbe0a07 100644 --- a/direct/src/plugin/p3dAuthSession.cxx +++ b/direct/src/plugin/p3dAuthSession.cxx @@ -30,6 +30,8 @@ #include #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 ptrs; + std::vector ptrs; size_t p = 0; size_t zero = _env.find('\0', p); while (zero != string::npos) { diff --git a/direct/src/plugin/p3dBoolObject.cxx b/direct/src/plugin/p3dBoolObject.cxx index 87736ba216..7740c2f669 100644 --- a/direct/src/plugin/p3dBoolObject.cxx +++ b/direct/src/plugin/p3dBoolObject.cxx @@ -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 { diff --git a/direct/src/plugin/p3dCert.cxx b/direct/src/plugin/p3dCert.cxx index f47723d466..e6868bdb80 100644 --- a/direct/src/plugin/p3dCert.cxx +++ b/direct/src/plugin/p3dCert.cxx @@ -46,6 +46,10 @@ #include #endif +using std::cerr; +using std::string; +using std::wstring; + static LanguageIndex li = LI_default; #if defined(_WIN32) diff --git a/direct/src/plugin/p3dCert.h b/direct/src/plugin/p3dCert.h index 1583727565..3c856c6ec3 100644 --- a/direct/src/plugin/p3dCert.h +++ b/direct/src/plugin/p3dCert.h @@ -25,7 +25,6 @@ #include #include #include -using namespace std; class ViewCertDialog; diff --git a/direct/src/plugin/p3dCert_wx.cxx b/direct/src/plugin/p3dCert_wx.cxx index d2e5a78801..125732adda 100644 --- a/direct/src/plugin/p3dCert_wx.cxx +++ b/direct/src/plugin/p3dCert_wx.cxx @@ -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)); } diff --git a/direct/src/plugin/p3dCert_wx.h b/direct/src/plugin/p3dCert_wx.h index bced0ec91f..1ea8765a17 100644 --- a/direct/src/plugin/p3dCert_wx.h +++ b/direct/src/plugin/p3dCert_wx.h @@ -24,7 +24,6 @@ #include #include #include -using namespace std; class ViewCertDialog; diff --git a/direct/src/plugin/p3dConcreteSequence.cxx b/direct/src/plugin/p3dConcreteSequence.cxx index 2dd6dbf29e..ec4291cb7b 100644 --- a/direct/src/plugin/p3dConcreteSequence.cxx +++ b/direct/src/plugin/p3dConcreteSequence.cxx @@ -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); diff --git a/direct/src/plugin/p3dConcreteStruct.cxx b/direct/src/plugin/p3dConcreteStruct.cxx index 753bcb2b83..fa9917d955 100644 --- a/direct/src/plugin/p3dConcreteStruct.cxx +++ b/direct/src/plugin/p3dConcreteStruct.cxx @@ -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 result = _elements.insert(Elements::value_type(property, value)); + std::pair result = _elements.insert(Elements::value_type(property, value)); if (!result.second) { // Replacing an element. Elements::iterator ei = result.first; diff --git a/direct/src/plugin/p3dDownload.cxx b/direct/src/plugin/p3dDownload.cxx index 6423b4d9a7..3b6a6cca7a 100644 --- a/direct/src/plugin/p3dDownload.cxx +++ b/direct/src/plugin/p3dDownload.cxx @@ -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. diff --git a/direct/src/plugin/p3dFileDownload.cxx b/direct/src/plugin/p3dFileDownload.cxx index 2d1a85497e..a978c3640e 100644 --- a/direct/src/plugin/p3dFileDownload.cxx +++ b/direct/src/plugin/p3dFileDownload.cxx @@ -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"; diff --git a/direct/src/plugin/p3dFileParams.cxx b/direct/src/plugin/p3dFileParams.cxx index 1be229e3bb..a32ede4b95 100644 --- a/direct/src/plugin/p3dFileParams.cxx +++ b/direct/src/plugin/p3dFileParams.cxx @@ -14,6 +14,8 @@ #include "p3dFileParams.h" #include +using std::string; + /** * */ diff --git a/direct/src/plugin/p3dFloatObject.cxx b/direct/src/plugin/p3dFloatObject.cxx index 2581c44282..3262d45a54 100644 --- a/direct/src/plugin/p3dFloatObject.cxx +++ b/direct/src/plugin/p3dFloatObject.cxx @@ -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(); } diff --git a/direct/src/plugin/p3dHost.cxx b/direct/src/plugin/p3dHost.cxx index 028af6bef0..991a66df3e 100644 --- a/direct/src/plugin/p3dHost.cxx +++ b/direct/src/plugin/p3dHost.cxx @@ -25,6 +25,11 @@ #include #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 &result, int num_mirrors) { - vector selected; +choose_random_mirrors(std::vector &result, int num_mirrors) { + std::vector 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()) { diff --git a/direct/src/plugin/p3dInstance.cxx b/direct/src/plugin/p3dInstance.cxx index 21e608d5a5..220e28c667 100644 --- a/direct/src/plugin/p3dInstance.cxx +++ b/direct/src/plugin/p3dInstance.cxx @@ -34,6 +34,14 @@ #include #include +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 hosts; + std::set 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::iterator hi; + std::set::iterator hi; for (hi = hosts.begin(); hi != hosts.end(); ++hi) { P3DHost *host = (*hi); host->uninstall(); diff --git a/direct/src/plugin/p3dInstanceManager.cxx b/direct/src/plugin/p3dInstanceManager.cxx index 3b8c52ba15..93e2ffcfc2 100644 --- a/direct/src/plugin/p3dInstanceManager.cxx +++ b/direct/src/plugin/p3dInstanceManager.cxx @@ -50,8 +50,12 @@ #include +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; } diff --git a/direct/src/plugin/p3dIntObject.cxx b/direct/src/plugin/p3dIntObject.cxx index 4fa4b14aaf..05ad970128 100644 --- a/direct/src/plugin/p3dIntObject.cxx +++ b/direct/src/plugin/p3dIntObject.cxx @@ -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(); } diff --git a/direct/src/plugin/p3dMainObject.cxx b/direct/src/plugin/p3dMainObject.cxx index adda6129d6..2fd8dba33d 100644 --- a/direct/src/plugin/p3dMainObject.cxx +++ b/direct/src/plugin/p3dMainObject.cxx @@ -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 all_logs; + std::vector 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; diff --git a/direct/src/plugin/p3dMultifileReader.cxx b/direct/src/plugin/p3dMultifileReader.cxx index dfaf4d8a2d..e47400bdb6 100644 --- a/direct/src/plugin/p3dMultifileReader.cxx +++ b/direct/src/plugin/p3dMultifileReader.cxx @@ -23,6 +23,13 @@ #include #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; diff --git a/direct/src/plugin/p3dNoneObject.cxx b/direct/src/plugin/p3dNoneObject.cxx index 0245b61174..2a1653a2b8 100644 --- a/direct/src/plugin/p3dNoneObject.cxx +++ b/direct/src/plugin/p3dNoneObject.cxx @@ -41,6 +41,6 @@ get_bool() { * to a string. */ void P3DNoneObject:: -make_string(string &value) { +make_string(std::string &value) { value = "None"; } diff --git a/direct/src/plugin/p3dObject.cxx b/direct/src/plugin/p3dObject.cxx index a8393a6c11..f34f2d6d2d 100644 --- a/direct/src/plugin/p3dObject.cxx +++ b/direct/src/plugin/p3dObject.cxx @@ -19,6 +19,8 @@ #include "p3dInstanceManager.h" #include // 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; diff --git a/direct/src/plugin/p3dOsxSplashWindow.cxx b/direct/src/plugin/p3dOsxSplashWindow.cxx index d504d58671..4139a9629d 100644 --- a/direct/src/plugin/p3dOsxSplashWindow.cxx +++ b/direct/src/plugin/p3dOsxSplashWindow.cxx @@ -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); diff --git a/direct/src/plugin/p3dPackage.cxx b/direct/src/plugin/p3dPackage.cxx index 1efead479b..fad2dd97f2 100644 --- a/direct/src/plugin/p3dPackage.cxx +++ b/direct/src/plugin/p3dPackage.cxx @@ -29,6 +29,12 @@ #include // 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; diff --git a/direct/src/plugin/p3dPatchFinder.cxx b/direct/src/plugin/p3dPatchFinder.cxx index 044953b3af..fbc109fe8c 100644 --- a/direct/src/plugin/p3dPatchFinder.cxx +++ b/direct/src/plugin/p3dPatchFinder.cxx @@ -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); diff --git a/direct/src/plugin/p3dPatchfileReader.cxx b/direct/src/plugin/p3dPatchfileReader.cxx index 255bed8477..14ede5e9f9 100644 --- a/direct/src/plugin/p3dPatchfileReader.cxx +++ b/direct/src/plugin/p3dPatchfileReader.cxx @@ -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(); } diff --git a/direct/src/plugin/p3dPythonMain.cxx b/direct/src/plugin/p3dPythonMain.cxx index 3d8bbdc9e8..b5d11e6052 100644 --- a/direct/src/plugin/p3dPythonMain.cxx +++ b/direct/src/plugin/p3dPythonMain.cxx @@ -18,7 +18,6 @@ #include #include #include // 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 argv; + std::vector 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; } diff --git a/direct/src/plugin/p3dPythonObject.cxx b/direct/src/plugin/p3dPythonObject.cxx index fb52163b71..58a2d0348f 100644 --- a/direct/src/plugin/p3dPythonObject.cxx +++ b/direct/src/plugin/p3dPythonObject.cxx @@ -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 cresult = _has_method.insert(HasMethod::value_type(method_name, false)); + std::pair 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) { diff --git a/direct/src/plugin/p3dPythonRun.cxx b/direct/src/plugin/p3dPythonRun.cxx index 3d657597fe..b9e4c5655e 100644 --- a/direct/src/plugin/p3dPythonRun.cxx +++ b/direct/src/plugin/p3dPythonRun.cxx @@ -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); } diff --git a/direct/src/plugin/p3dPythonRun.h b/direct/src/plugin/p3dPythonRun.h index e478670cca..ee3fbc3d00 100644 --- a/direct/src/plugin/p3dPythonRun.h +++ b/direct/src/plugin/p3dPythonRun.h @@ -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 diff --git a/direct/src/plugin/p3dSession.cxx b/direct/src/plugin/p3dSession.cxx index cb0fb58d78..4a769ec9e1 100644 --- a/direct/src/plugin/p3dSession.cxx +++ b/direct/src/plugin/p3dSession.cxx @@ -43,6 +43,9 @@ #include #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 all_logs; + std::vector 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 matching_logs; + std::vector 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 ptrs; + std::vector 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(); diff --git a/direct/src/plugin/p3dSplashWindow.cxx b/direct/src/plugin/p3dSplashWindow.cxx index 2660cb2b3e..13bcc09ff2 100644 --- a/direct/src/plugin/p3dSplashWindow.cxx +++ b/direct/src/plugin/p3dSplashWindow.cxx @@ -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; diff --git a/direct/src/plugin/p3dStringObject.cxx b/direct/src/plugin/p3dStringObject.cxx index d0188a65af..8d87a2dc8c 100644 --- a/direct/src/plugin/p3dStringObject.cxx +++ b/direct/src/plugin/p3dStringObject.cxx @@ -17,7 +17,7 @@ * */ P3DStringObject:: -P3DStringObject(const string &value) : _value(value) { +P3DStringObject(const std::string &value) : _value(value) { } /** @@ -65,7 +65,7 @@ get_bool() { * to a string. */ void P3DStringObject:: -make_string(string &value) { +make_string(std::string &value) { value = _value; } @@ -74,9 +74,9 @@ make_string(string &value) { * This is intended for developer assistance. */ void P3DStringObject:: -output(ostream &out) { +output(std::ostream &out) { out << '"'; - for (string::const_iterator si = _value.begin(); si != _value.end(); ++si) { + for (std::string::const_iterator si = _value.begin(); si != _value.end(); ++si) { if (isprint(*si)) { switch (*si) { case '"': diff --git a/direct/src/plugin/p3dTemporaryFile.cxx b/direct/src/plugin/p3dTemporaryFile.cxx index ca7abe701a..bb7c8ca7a1 100644 --- a/direct/src/plugin/p3dTemporaryFile.cxx +++ b/direct/src/plugin/p3dTemporaryFile.cxx @@ -18,7 +18,7 @@ * Constructs a new, unique temporary filename. */ P3DTemporaryFile:: -P3DTemporaryFile(const string &extension) { +P3DTemporaryFile(const std::string &extension) { P3DInstanceManager *inst_mgr = P3DInstanceManager::get_global_ptr(); _filename = inst_mgr->make_temp_filename(extension); } diff --git a/direct/src/plugin/p3dUndefinedObject.cxx b/direct/src/plugin/p3dUndefinedObject.cxx index 80cbb5897d..0ed227573f 100644 --- a/direct/src/plugin/p3dUndefinedObject.cxx +++ b/direct/src/plugin/p3dUndefinedObject.cxx @@ -41,6 +41,6 @@ get_bool() { * to a string. */ void P3DUndefinedObject:: -make_string(string &value) { +make_string(std::string &value) { value = "Undefined"; } diff --git a/direct/src/plugin/p3dWinSplashWindow.cxx b/direct/src/plugin/p3dWinSplashWindow.cxx index 5cc189b31c..256acb5eb8 100644 --- a/direct/src/plugin/p3dWinSplashWindow.cxx +++ b/direct/src/plugin/p3dWinSplashWindow.cxx @@ -95,7 +95,7 @@ set_visible(bool visible) { * the splash window. */ void P3DWinSplashWindow:: -set_image_filename(const string &image_filename, ImagePlacement image_placement) { +set_image_filename(const std::string &image_filename, ImagePlacement image_placement) { nout << "image_filename = " << image_filename << ", thread_id = " << _thread_id << "\n"; WinImageData *image = nullptr; switch (image_placement) { @@ -141,7 +141,7 @@ set_image_filename(const string &image_filename, ImagePlacement image_placement) * Specifies the text that is displayed above the install progress bar. */ void P3DWinSplashWindow:: -set_install_label(const string &install_label) { +set_install_label(const std::string &install_label) { ACQUIRE_LOCK(_install_lock); if (_install_label != install_label) { _install_label = install_label; @@ -493,7 +493,7 @@ update_image(WinImageData &image) { InvalidateRect(_hwnd, nullptr, TRUE); // Go read the image. - string data; + std::string data; if (!read_image_data(image, data, image._filename)) { return; } @@ -715,7 +715,7 @@ paint_image(HDC dc, const WinImageData &image, bool use_alpha) { // 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); diff --git a/direct/src/plugin/p3dWindowParams.cxx b/direct/src/plugin/p3dWindowParams.cxx index e6e9b750e4..29ed954823 100644 --- a/direct/src/plugin/p3dWindowParams.cxx +++ b/direct/src/plugin/p3dWindowParams.cxx @@ -78,7 +78,7 @@ make_xml(P3DInstance *inst) { // TinyXml doesn't support a "long" attribute. We'll use stringstream to // do it ourselves. { - ostringstream strm; + std::ostringstream strm; assert(_parent_window._window_handle_type == P3D_WHT_x11_window); strm << _parent_window._handle._x11_window._xwindow; xwparams->SetAttribute("parent_xwindow", strm.str()); diff --git a/direct/src/plugin/p3dX11SplashWindow.cxx b/direct/src/plugin/p3dX11SplashWindow.cxx index 2e1bbcb66e..07e5fc4d99 100644 --- a/direct/src/plugin/p3dX11SplashWindow.cxx +++ b/direct/src/plugin/p3dX11SplashWindow.cxx @@ -24,6 +24,9 @@ #include #include +using std::string; +using std::vector; + /** * */ @@ -1284,7 +1287,7 @@ scale_image(vector &image0, int &image0_width, int &image0_height } else { // Yuck, the bad case - we need to scale it down. - double scale = min((double)_win_width / (double)image._width, + double scale = std::min((double)_win_width / (double)image._width, (double)_win_height / (double)image._height); image0_width = (int)(image._width * scale); image0_height = (int)(image._height * scale); @@ -1335,8 +1338,8 @@ compose_two_images(vector &image0, int &image0_width, int &image0 const vector &image1, int image1_width, int image1_height, const vector &image2, int image2_width, int image2_height) { // First, the resulting image size is the larger of the two. - image0_width = max(image1_width, image2_width); - image0_height = max(image1_height, image2_height); + image0_width = std::max(image1_width, image2_width); + image0_height = std::max(image1_height, image2_height); int new_row_stride = image0_width * 4; int new_data_length = image0_height * new_row_stride; diff --git a/direct/src/plugin/p3d_plugin.cxx b/direct/src/plugin/p3d_plugin.cxx index 5cddf55b31..7e6c01108b 100644 --- a/direct/src/plugin/p3d_plugin.cxx +++ b/direct/src/plugin/p3d_plugin.cxx @@ -448,7 +448,7 @@ P3D_new_string_object(const char *str, int length) { assert(P3DInstanceManager::get_global_ptr()->is_initialized()); ACQUIRE_LOCK(_api_lock); - P3D_object *result = new P3DStringObject(string(str, length)); + P3D_object *result = new P3DStringObject(std::string(str, length)); RELEASE_LOCK(_api_lock); return result; diff --git a/direct/src/plugin/p3d_plugin_common.h b/direct/src/plugin/p3d_plugin_common.h index 748005c48d..6ddd0e057c 100644 --- a/direct/src/plugin/p3d_plugin_common.h +++ b/direct/src/plugin/p3d_plugin_common.h @@ -34,8 +34,6 @@ #include #include -using namespace std; - // Appears in p3dInstanceManager.cxx. extern std::ostream *nout_stream; #define nout (*nout_stream) diff --git a/direct/src/plugin/parse_color.cxx b/direct/src/plugin/parse_color.cxx index e3094e9d40..4a5f12b587 100644 --- a/direct/src/plugin/parse_color.cxx +++ b/direct/src/plugin/parse_color.cxx @@ -22,7 +22,7 @@ static bool parse_hexdigit(int &result, char digit); * in the range 0..255. On failure, r, g, b are undefined. */ bool -parse_color(int &r, int &g, int &b, const string &color) { +parse_color(int &r, int &g, int &b, const std::string &color) { if (color.empty() || color[0] != '#') { return false; } diff --git a/direct/src/plugin/parse_color.h b/direct/src/plugin/parse_color.h index ba5dd152a8..794abf2055 100644 --- a/direct/src/plugin/parse_color.h +++ b/direct/src/plugin/parse_color.h @@ -15,7 +15,6 @@ #define PARSE_COLOR_H #include -using namespace std; bool parse_color(int &r, int &g, int &b, const std::string &color); diff --git a/direct/src/plugin/wstring_encode.cxx b/direct/src/plugin/wstring_encode.cxx index 3766e7dc10..e844d643bd 100644 --- a/direct/src/plugin/wstring_encode.cxx +++ b/direct/src/plugin/wstring_encode.cxx @@ -21,13 +21,12 @@ #include #endif // _WIN32 - #ifdef _WIN32 /** * Encodes std::wstring to std::string using UTF-8. */ bool -wstring_to_string(string &result, const wstring &source) { +wstring_to_string(std::string &result, const std::wstring &source) { bool success = false; int size = WideCharToMultiByte(CP_UTF8, 0, source.data(), source.length(), nullptr, 0, nullptr, nullptr); @@ -51,7 +50,7 @@ wstring_to_string(string &result, const wstring &source) { * Decodes std::string to std::wstring using UTF-8. */ bool -string_to_wstring(wstring &result, const string &source) { +string_to_wstring(std::wstring &result, const std::string &source) { bool success = false; int size = MultiByteToWideChar(CP_UTF8, 0, source.data(), source.length(), nullptr, 0); diff --git a/direct/src/plugin/wstring_encode.h b/direct/src/plugin/wstring_encode.h index 5d5ebab4de..b9641bd43d 100644 --- a/direct/src/plugin/wstring_encode.h +++ b/direct/src/plugin/wstring_encode.h @@ -15,7 +15,6 @@ #define WSTRING_ENCODE_H #include -using namespace std; // Presently, these two functions are implemented only for Windows, which is // the only place they are needed. (Only Windows requires wstrings for diff --git a/direct/src/plugin/xml_helpers.cxx b/direct/src/plugin/xml_helpers.cxx index 20da4ce7ca..9a997189da 100644 --- a/direct/src/plugin/xml_helpers.cxx +++ b/direct/src/plugin/xml_helpers.cxx @@ -21,7 +21,7 @@ * empty. */ bool -parse_bool_attrib(TiXmlElement *xelem, const string &attrib, +parse_bool_attrib(TiXmlElement *xelem, const std::string &attrib, bool default_value) { const char *value = xelem->Attribute(attrib.c_str()); if (value == nullptr || *value == '\0') { diff --git a/direct/src/plugin_npapi/nppanda3d_common.h b/direct/src/plugin_npapi/nppanda3d_common.h index a3bb8f0191..c1b7cd61af 100644 --- a/direct/src/plugin_npapi/nppanda3d_common.h +++ b/direct/src/plugin_npapi/nppanda3d_common.h @@ -30,8 +30,6 @@ #include #include -using namespace std; - // Appears in startup.cxx. extern std::ostream *nout_stream; #define nout (*nout_stream) diff --git a/direct/src/plugin_npapi/ppBrowserObject.cxx b/direct/src/plugin_npapi/ppBrowserObject.cxx index 9655295141..17104b9e6c 100644 --- a/direct/src/plugin_npapi/ppBrowserObject.cxx +++ b/direct/src/plugin_npapi/ppBrowserObject.cxx @@ -16,6 +16,8 @@ #include #include // strncpy +using std::string; + // The following functions are C-style wrappers around the above // PPBrowserObject methods; they are defined to allow us to create the C-style // P3D_class_definition method table to store in the P3D_object structure. @@ -105,7 +107,7 @@ PPBrowserObject:: */ int PPBrowserObject:: get_repr(char *buffer, int buffer_length) const { - ostringstream strm; + std::ostringstream strm; strm << "NPObject " << _npobj; string result = strm.str(); strncpy(buffer, result.c_str(), buffer_length); diff --git a/direct/src/plugin_npapi/ppInstance.cxx b/direct/src/plugin_npapi/ppInstance.cxx index 8e3281c405..6a3d961e32 100644 --- a/direct/src/plugin_npapi/ppInstance.cxx +++ b/direct/src/plugin_npapi/ppInstance.cxx @@ -41,6 +41,12 @@ #include #endif // HAVE_X11 +using std::ios; +using std::ostream; +using std::ostringstream; +using std::string; +using std::vector; + PPInstance::FileDatas PPInstance::_file_datas; @@ -1154,7 +1160,7 @@ void PPInstance:: choose_random_mirrors(vector &result, int num_mirrors) { vector 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()) { @@ -1313,11 +1319,11 @@ read_contents_file(const string &contents_filename, bool fresh_download) { xorig->Attribute("expiration", &expiration); } - _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"; // Look for the entry; it might point us at a different download @@ -2411,7 +2417,7 @@ copy_cocoa_event(P3DCocoaEvent *p3d_event, NPCocoaEvent *np_event, * returns result.c_str(). */ const wchar_t *PPInstance:: -make_ansi_string(wstring &result, NPNSString *ns_string) { +make_ansi_string(std::wstring &result, NPNSString *ns_string) { result.clear(); if (ns_string != nullptr) { diff --git a/direct/src/plugin_npapi/ppPandaObject.cxx b/direct/src/plugin_npapi/ppPandaObject.cxx index f85ef43407..e4e4854c3f 100644 --- a/direct/src/plugin_npapi/ppPandaObject.cxx +++ b/direct/src/plugin_npapi/ppPandaObject.cxx @@ -13,6 +13,8 @@ #include "ppPandaObject.h" +using std::string; + NPClass PPPandaObject::_object_class = { NP_CLASS_STRUCT_VERSION, &PPPandaObject::NPAllocate, @@ -304,7 +306,7 @@ identifier_to_string(NPIdentifier ident) { // Firefox does, but Safari doesn't appear to use integer identifiers and // just sends everything as a string identifier. So to make things // consistent internally, we also send everything as a string. - ostringstream strm; + std::ostringstream strm; strm << browser->intfromidentifier(ident); return strm.str(); } diff --git a/direct/src/plugin_npapi/startup.cxx b/direct/src/plugin_npapi/startup.cxx index 0c6a99c258..315a21f8cc 100644 --- a/direct/src/plugin_npapi/startup.cxx +++ b/direct/src/plugin_npapi/startup.cxx @@ -23,8 +23,10 @@ #include #endif +using std::string; + static ofstream logfile; -ostream *nout_stream = &logfile; +std::ostream *nout_stream = &logfile; string global_root_dir; bool has_plugin_thread_async_call; @@ -62,7 +64,7 @@ open_logfile() { if (log_directory.empty()) { log_directory = global_root_dir + "/log"; } - mkdir_complete(log_directory, cerr); + mkdir_complete(log_directory, std::cerr); // Ensure that the log directory ends with a slash. if (!log_directory.empty() && log_directory[log_directory.size() - 1] != '/') { @@ -92,13 +94,13 @@ open_logfile() { logfile.close(); logfile.clear(); #ifdef _WIN32 - wstring log_pathname_w; + std::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 - logfile.setf(ios::unitbuf); + logfile.setf(std::ios::unitbuf); } // If we didn't have a logfile name compiled in, we throw away log output diff --git a/direct/src/plugin_standalone/p3dEmbed.cxx b/direct/src/plugin_standalone/p3dEmbed.cxx index 14903aa600..1d191e9c22 100644 --- a/direct/src/plugin_standalone/p3dEmbed.cxx +++ b/direct/src/plugin_standalone/p3dEmbed.cxx @@ -17,6 +17,9 @@ #include "load_plugin.h" #include "find_root_dir.h" +using std::cerr; +using std::string; + /** * */ @@ -36,7 +39,7 @@ P3DEmbed(bool console_environment) : Panda3DBase(console_environment) { * offset. */ int P3DEmbed:: -run_embedded(streampos read_offset, int argc, char *argv[]) { +run_embedded(std::streampos read_offset, int argc, char *argv[]) { // Check to see if we've actually got an application embedded. If we do, // read_offset will have been modified to contain a different value than the // one we compiled in, above. We test against read_offset + 1, because any @@ -46,8 +49,8 @@ run_embedded(streampos read_offset, int argc, char *argv[]) { // We also have to store this computation in a member variable, to work // around a compiler optimization that might otherwise remove the + 1 from // the test. - _read_offset_check = read_offset + (streampos)1; - if (_read_offset_check == (streampos)0xFF3D3D01) { + _read_offset_check = read_offset + (std::streampos)1; + if (_read_offset_check == (std::streampos)0xFF3D3D01) { cerr << "This program is not intended to be run directly.\nIt is used " "by pdeploy to construct an embedded Panda3D application.\n"; return 1; diff --git a/direct/src/plugin_standalone/panda3d.cxx b/direct/src/plugin_standalone/panda3d.cxx index 8710d92696..d21933a441 100644 --- a/direct/src/plugin_standalone/panda3d.cxx +++ b/direct/src/plugin_standalone/panda3d.cxx @@ -29,6 +29,10 @@ #include #endif +using std::cerr; +using std::cout; +using std::string; + /** * */ @@ -410,7 +414,7 @@ download_contents_file(const Filename &contents_filename) { if (!success) { // Go download contents.xml from the actual host. - ostringstream strm; + std::ostringstream strm; strm << _host_url_prefix << "contents.xml"; // Append a uniquifying query string to the URL to force the download to // go all the way through any caches. We use the time in seconds; that's @@ -498,7 +502,7 @@ read_contents_file(const Filename &contents_filename, bool fresh_download) { xorig->Attribute("expiration", &expiration); } - _contents_expiration = min(_contents_expiration, (time_t)expiration); + _contents_expiration = std::min(_contents_expiration, (time_t)expiration); } // Look for the entry; it might point us at a different download @@ -670,7 +674,7 @@ void Panda3D:: choose_random_mirrors(vector_string &result, int num_mirrors) { pvector 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()) { @@ -740,7 +744,7 @@ get_core_api() { #endif // Format the coreapi_timestamp as a string, for passing as a parameter. - ostringstream stream; + std::ostringstream stream; stream << _coreapi_dll.get_timestamp(); string coreapi_timestamp = stream.str(); @@ -765,7 +769,7 @@ download_core_api() { // Our last act of desperation: hit the original host, with a query // uniquifier, to break through any caches. - ostringstream strm; + std::ostringstream strm; strm << _download_url_prefix << _coreapi_dll.get_filename() << "?" << time(nullptr); url = strm.str(); diff --git a/direct/src/plugin_standalone/panda3dBase.cxx b/direct/src/plugin_standalone/panda3dBase.cxx index 07f86fb18a..cfdaeb1350 100644 --- a/direct/src/plugin_standalone/panda3dBase.cxx +++ b/direct/src/plugin_standalone/panda3dBase.cxx @@ -35,6 +35,9 @@ #include #include +using std::cerr; +using std::string; + // The amount of time in seconds to wait for new messages. static const double wait_cycle = 0.2; @@ -436,7 +439,7 @@ read_p3d_info(const Filename &p3d_filename, int p3d_offset) { string p3d_info; mf->read_subfile(si, p3d_info); - istringstream strm(p3d_info); + std::istringstream strm(p3d_info); TiXmlDocument doc; strm >> doc; if (strm.fail() && !strm.eof()) { diff --git a/direct/src/plugin_standalone/panda3dMac.cxx b/direct/src/plugin_standalone/panda3dMac.cxx index 06877b9af0..5a87c60d3e 100644 --- a/direct/src/plugin_standalone/panda3dMac.cxx +++ b/direct/src/plugin_standalone/panda3dMac.cxx @@ -16,7 +16,6 @@ #include #include -using namespace std; // Having a global Panda3DMac object just makes things easier. static Panda3DMac *this_prog; @@ -48,7 +47,7 @@ open_p3d_file(FSRef *ref) { UInt8 filename[buffer_size]; err = FSRefMakePath(ref, filename, buffer_size); if (err) { - cerr << "Couldn't get filename\n"; + std::cerr << "Couldn't get filename\n"; return; } diff --git a/direct/src/plugin_standalone/panda3dWinMain.cxx b/direct/src/plugin_standalone/panda3dWinMain.cxx index dbf951da4c..ec7b8e630c 100644 --- a/direct/src/plugin_standalone/panda3dWinMain.cxx +++ b/direct/src/plugin_standalone/panda3dWinMain.cxx @@ -22,7 +22,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. @@ -39,7 +39,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; @@ -51,7 +51,7 @@ int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) { char *command_line = GetCommandLine(); - vector argv; + std::vector argv; char *p = command_line; while (*p != '\0') { diff --git a/direct/src/showbase/showBase.cxx b/direct/src/showbase/showBase.cxx index 12aa08d4bd..f14d9610a4 100644 --- a/direct/src/showbase/showBase.cxx +++ b/direct/src/showbase/showBase.cxx @@ -34,6 +34,9 @@ TOGGLEKEYS g_StartupToggleKeys = {sizeof(TOGGLEKEYS), 0}; FILTERKEYS g_StartupFilterKeys = {sizeof(FILTERKEYS), 0}; #endif +using std::max; +using std::min; + #if !defined(CPPPARSER) && !defined(BUILDING_DIRECT_SHOWBASE) #error Buildsystem error: BUILDING_DIRECT_SHOWBASE not defined #endif @@ -201,7 +204,7 @@ add_grid_zone(unsigned int x, // zoneBase is the first zone in the grid (e.g. the upper left) // zoneResolution is the number of cells on each axsis. returns the next // available zoneBase (i.e. zoneBase+xZoneResolution*yZoneResolution) - cerr<<"adding grid zone with a zoneBase of "< 1.0 || y < 0.0 || y > 1.0) { return 0; } - cerr<<"resolution="<output(out, indent_level, scope, complete); out << "["; @@ -180,16 +180,16 @@ output(ostream &out, int indent_level, CPPScope *scope, bool complete) const { * have special exceptions. */ void CPPArrayType:: -output_instance(ostream &out, int indent_level, CPPScope *scope, - bool complete, const string &prename, - const string &name) const { - ostringstream brackets; +output_instance(std::ostream &out, int indent_level, CPPScope *scope, + bool complete, const std::string &prename, + const std::string &name) const { + std::ostringstream brackets; brackets << "["; if (_bounds != nullptr) { brackets << *_bounds; } brackets << "]"; - string bracketsstr = brackets.str(); + std::string bracketsstr = brackets.str(); _element_type->output_instance(out, indent_level, scope, complete, prename, name + bracketsstr); diff --git a/dtool/src/cppparser/cppBison.cxx.prebuilt b/dtool/src/cppparser/cppBison.cxx.prebuilt index f1985d488e..4bff774461 100644 --- a/dtool/src/cppparser/cppBison.cxx.prebuilt +++ b/dtool/src/cppparser/cppBison.cxx.prebuilt @@ -97,6 +97,9 @@ #include "cppNamespace.h" #include "cppUsing.h" +using std::stringstream; +using std::string; + //////////////////////////////////////////////////////////////////// // Defining the interface to the parser. //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/cppparser/cppBison.yxx b/dtool/src/cppparser/cppBison.yxx index d132677763..5c2721eea7 100644 --- a/dtool/src/cppparser/cppBison.yxx +++ b/dtool/src/cppparser/cppBison.yxx @@ -32,6 +32,9 @@ #include "cppNamespace.h" #include "cppUsing.h" +using std::stringstream; +using std::string; + //////////////////////////////////////////////////////////////////// // Defining the interface to the parser. //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/cppparser/cppBisonDefs.h b/dtool/src/cppparser/cppBisonDefs.h index 1c7be65b85..9e8f71f9b1 100644 --- a/dtool/src/cppparser/cppBisonDefs.h +++ b/dtool/src/cppparser/cppBisonDefs.h @@ -27,8 +27,6 @@ #include "cppExtensionType.h" #include "cppFile.h" -using namespace std; - class CPPParser; class CPPExpression; class CPPPreprocessor; diff --git a/dtool/src/cppparser/cppClassTemplateParameter.cxx b/dtool/src/cppparser/cppClassTemplateParameter.cxx index 46fb525b8b..7c85eb6c24 100644 --- a/dtool/src/cppparser/cppClassTemplateParameter.cxx +++ b/dtool/src/cppparser/cppClassTemplateParameter.cxx @@ -40,7 +40,7 @@ is_fully_specified() const { * */ void CPPClassTemplateParameter:: -output(ostream &out, int indent_level, CPPScope *scope, bool complete) const { +output(std::ostream &out, int indent_level, CPPScope *scope, bool complete) const { if (complete) { out << "class"; if (_packed) { diff --git a/dtool/src/cppparser/cppClosureType.cxx b/dtool/src/cppparser/cppClosureType.cxx index 974742e5df..1d12602c3b 100644 --- a/dtool/src/cppparser/cppClosureType.cxx +++ b/dtool/src/cppparser/cppClosureType.cxx @@ -49,7 +49,7 @@ operator = (const CPPClosureType ©) { * Adds a new capture to the beginning of the capture list. */ void CPPClosureType:: -add_capture(string name, CaptureType type, CPPExpression *initializer) { +add_capture(std::string name, CaptureType type, CPPExpression *initializer) { if (type == CT_none) { if (name == "this") { type = CT_by_reference; @@ -58,8 +58,8 @@ add_capture(string name, CaptureType type, CPPExpression *initializer) { } } - Capture capture = {move(name), type, initializer}; - _captures.insert(_captures.begin(), move(capture)); + Capture capture = {std::move(name), type, initializer}; + _captures.insert(_captures.begin(), std::move(capture)); } /** @@ -100,7 +100,7 @@ is_destructible() const { * */ void CPPClosureType:: -output(ostream &out, int indent_level, CPPScope *scope, bool complete) const { +output(std::ostream &out, int indent_level, CPPScope *scope, bool complete) const { out.put('['); bool have_capture = false; diff --git a/dtool/src/cppparser/cppConstType.cxx b/dtool/src/cppparser/cppConstType.cxx index f7eb198782..139a25dc5c 100644 --- a/dtool/src/cppparser/cppConstType.cxx +++ b/dtool/src/cppparser/cppConstType.cxx @@ -171,7 +171,7 @@ is_equivalent(const CPPType &other) const { * */ void CPPConstType:: -output(ostream &out, int indent_level, CPPScope *scope, bool complete) const { +output(std::ostream &out, int indent_level, CPPScope *scope, bool complete) const { _wrapped_around->output(out, indent_level, scope, complete); out << " const"; } @@ -182,9 +182,9 @@ output(ostream &out, int indent_level, CPPScope *scope, bool complete) const { * have special exceptions. */ void CPPConstType:: -output_instance(ostream &out, int indent_level, CPPScope *scope, - bool complete, const string &prename, - const string &name) const { +output_instance(std::ostream &out, int indent_level, CPPScope *scope, + bool complete, const std::string &prename, + const std::string &name) const { _wrapped_around->output_instance(out, indent_level, scope, complete, "const " + prename, name); } diff --git a/dtool/src/cppparser/cppDeclaration.cxx b/dtool/src/cppparser/cppDeclaration.cxx index 444801ceea..0125ed4289 100644 --- a/dtool/src/cppparser/cppDeclaration.cxx +++ b/dtool/src/cppparser/cppDeclaration.cxx @@ -338,8 +338,8 @@ is_less(const CPPDeclaration *other) const { } -ostream & -operator << (ostream &out, const CPPDeclaration::SubstDecl &subst) { +std::ostream & +operator << (std::ostream &out, const CPPDeclaration::SubstDecl &subst) { CPPDeclaration::SubstDecl::const_iterator it; for (it = subst.begin(); it != subst.end(); ++it) { out << " "; diff --git a/dtool/src/cppparser/cppDeclaration.h b/dtool/src/cppparser/cppDeclaration.h index d472c277fd..967dc6b6ec 100644 --- a/dtool/src/cppparser/cppDeclaration.h +++ b/dtool/src/cppparser/cppDeclaration.h @@ -25,8 +25,6 @@ #include #include -using namespace std; - class CPPInstance; class CPPTemplateParameterList; class CPPTypedefType; diff --git a/dtool/src/cppparser/cppEnumType.cxx b/dtool/src/cppparser/cppEnumType.cxx index ffbce64a7d..11fcd5da3e 100644 --- a/dtool/src/cppparser/cppEnumType.cxx +++ b/dtool/src/cppparser/cppEnumType.cxx @@ -89,7 +89,7 @@ get_underlying_type() { * */ CPPInstance *CPPEnumType:: -add_element(const string &name, CPPExpression *value, CPPPreprocessor *preprocessor, const cppyyltype &pos) { +add_element(const std::string &name, CPPExpression *value, CPPPreprocessor *preprocessor, const cppyyltype &pos) { CPPIdentifier *ident = new CPPIdentifier(name); ident->_native_scope = _parent_scope; @@ -262,7 +262,7 @@ substitute_decl(CPPDeclaration::SubstDecl &subst, * */ void CPPEnumType:: -output(ostream &out, int indent_level, CPPScope *scope, bool complete) const { +output(std::ostream &out, int indent_level, CPPScope *scope, bool complete) const { if (!complete && _ident != nullptr) { // If we have a name, use it. if (cppparser_output_class_keyword) { diff --git a/dtool/src/cppparser/cppExpression.cxx b/dtool/src/cppparser/cppExpression.cxx index ed36275af9..2b2cc0bd50 100644 --- a/dtool/src/cppparser/cppExpression.cxx +++ b/dtool/src/cppparser/cppExpression.cxx @@ -31,6 +31,9 @@ #include +using std::cerr; +using std::string; + /** * */ @@ -161,7 +164,7 @@ as_boolean() const { * */ void CPPExpression::Result:: -output(ostream &out) const { +output(std::ostream &out) const { switch (_type) { case RT_integer: out << _u._integer; @@ -1551,7 +1554,7 @@ is_tbd() const { * */ void CPPExpression:: -output(ostream &out, int indent_level, CPPScope *scope, bool) const { +output(std::ostream &out, int indent_level, CPPScope *scope, bool) const { switch (_type) { case T_nullptr: out << "nullptr"; @@ -1630,8 +1633,8 @@ output(ostream &out, int indent_level, CPPScope *scope, bool) const { if (isprint(*si)) { out << *si; } else { - out << '\\' << oct << setw(3) << setfill('0') << (int)(*si) - << dec << setw(0); + out << '\\' << std::oct << std::setw(3) << std::setfill('0') << (int)(*si) + << std::dec << std::setw(0); } } } diff --git a/dtool/src/cppparser/cppExpressionParser.cxx b/dtool/src/cppparser/cppExpressionParser.cxx index c0821712fc..ef5785eb5a 100644 --- a/dtool/src/cppparser/cppExpressionParser.cxx +++ b/dtool/src/cppparser/cppExpressionParser.cxx @@ -36,9 +36,9 @@ CPPExpressionParser:: * */ bool CPPExpressionParser:: -parse_expr(const string &expr) { +parse_expr(const std::string &expr) { if (!init_const_expr(expr)) { - cerr << "Unable to parse expression\n"; + std::cerr << "Unable to parse expression\n"; return false; } @@ -51,9 +51,9 @@ parse_expr(const string &expr) { * */ bool CPPExpressionParser:: -parse_expr(const string &expr, const CPPPreprocessor &filepos) { +parse_expr(const std::string &expr, const CPPPreprocessor &filepos) { if (!init_const_expr(expr)) { - cerr << "Unable to parse expression\n"; + std::cerr << "Unable to parse expression\n"; return false; } @@ -68,7 +68,7 @@ parse_expr(const string &expr, const CPPPreprocessor &filepos) { * */ void CPPExpressionParser:: -output(ostream &out) const { +output(std::ostream &out) const { if (_expr == nullptr) { out << "(null expr)"; } else { diff --git a/dtool/src/cppparser/cppExtensionType.cxx b/dtool/src/cppparser/cppExtensionType.cxx index ef5168334b..b7d23cb667 100644 --- a/dtool/src/cppparser/cppExtensionType.cxx +++ b/dtool/src/cppparser/cppExtensionType.cxx @@ -36,7 +36,7 @@ CPPExtensionType(CPPExtensionType::Type type, /** * */ -string CPPExtensionType:: +std::string CPPExtensionType:: get_simple_name() const { if (_ident == nullptr) { return ""; @@ -47,7 +47,7 @@ get_simple_name() const { /** * */ -string CPPExtensionType:: +std::string CPPExtensionType:: get_local_name(CPPScope *scope) const { if (_ident == nullptr) { return ""; @@ -58,7 +58,7 @@ get_local_name(CPPScope *scope) const { /** * */ -string CPPExtensionType:: +std::string CPPExtensionType:: get_fully_scoped_name() const { if (_ident == nullptr) { return ""; @@ -209,7 +209,7 @@ is_equivalent(const CPPType &other) const { * */ void CPPExtensionType:: -output(ostream &out, int, CPPScope *scope, bool complete) const { +output(std::ostream &out, int, CPPScope *scope, bool complete) const { if (_ident != nullptr) { // If we have a name, use it. if (complete || cppparser_output_class_keyword) { @@ -242,8 +242,8 @@ as_extension_type() { return this; } -ostream & -operator << (ostream &out, CPPExtensionType::Type type) { +std::ostream & +operator << (std::ostream &out, CPPExtensionType::Type type) { switch (type) { case CPPExtensionType::T_enum: return out << "enum"; diff --git a/dtool/src/cppparser/cppFile.cxx b/dtool/src/cppparser/cppFile.cxx index a42602013f..ce9a61ffc5 100644 --- a/dtool/src/cppparser/cppFile.cxx +++ b/dtool/src/cppparser/cppFile.cxx @@ -15,6 +15,8 @@ #include +using std::string; + /** * */ diff --git a/dtool/src/cppparser/cppFunctionGroup.cxx b/dtool/src/cppparser/cppFunctionGroup.cxx index fdec00184d..7904663d08 100644 --- a/dtool/src/cppparser/cppFunctionGroup.cxx +++ b/dtool/src/cppparser/cppFunctionGroup.cxx @@ -20,7 +20,7 @@ * */ CPPFunctionGroup:: -CPPFunctionGroup(const string &name) : +CPPFunctionGroup(const std::string &name) : CPPDeclaration(CPPFile()), _name(name) { @@ -61,7 +61,7 @@ get_return_type() const { * */ void CPPFunctionGroup:: -output(ostream &out, int indent_level, CPPScope *scope, bool complete) const { +output(std::ostream &out, int indent_level, CPPScope *scope, bool complete) const { if (!_instances.empty()) { Instances::const_iterator ii = _instances.begin(); (*ii)->output(out, indent_level, scope, complete); diff --git a/dtool/src/cppparser/cppFunctionType.cxx b/dtool/src/cppparser/cppFunctionType.cxx index 221297061d..27699d711b 100644 --- a/dtool/src/cppparser/cppFunctionType.cxx +++ b/dtool/src/cppparser/cppFunctionType.cxx @@ -16,6 +16,10 @@ #include "cppSimpleType.h" #include "cppInstance.h" +using std::ostream; +using std::ostringstream; +using std::string; + /** * */ diff --git a/dtool/src/cppparser/cppGlobals.cxx b/dtool/src/cppparser/cppGlobals.cxx index a435227203..f537ce8c42 100644 --- a/dtool/src/cppparser/cppGlobals.cxx +++ b/dtool/src/cppparser/cppGlobals.cxx @@ -13,4 +13,4 @@ #include "cppGlobals.h" -string cpp_longlong_keyword; +std::string cpp_longlong_keyword; diff --git a/dtool/src/cppparser/cppIdentifier.cxx b/dtool/src/cppparser/cppIdentifier.cxx index 9fd7b500c8..43c937177b 100644 --- a/dtool/src/cppparser/cppIdentifier.cxx +++ b/dtool/src/cppparser/cppIdentifier.cxx @@ -19,6 +19,8 @@ #include "cppTBDType.h" #include "cppStructType.h" +using std::string; + /** * @@ -546,7 +548,7 @@ substitute_decl(CPPDeclaration::SubstDecl &subst, * */ void CPPIdentifier:: -output(ostream &out, CPPScope *scope) const { +output(std::ostream &out, CPPScope *scope) const { if (scope == nullptr) { output_fully_scoped_name(out); } else { @@ -559,7 +561,7 @@ output(ostream &out, CPPScope *scope) const { * */ void CPPIdentifier:: -output_local_name(ostream &out, CPPScope *scope) const { +output_local_name(std::ostream &out, CPPScope *scope) const { assert(!_names.empty()); if (scope == nullptr || (_native_scope == nullptr && _names.size() == 1)) { @@ -583,7 +585,7 @@ output_local_name(ostream &out, CPPScope *scope) const { * */ void CPPIdentifier:: -output_fully_scoped_name(ostream &out) const { +output_fully_scoped_name(std::ostream &out) const { if (_native_scope != nullptr) { _native_scope->output(out, nullptr); out << "::"; diff --git a/dtool/src/cppparser/cppInstance.cxx b/dtool/src/cppparser/cppInstance.cxx index eb71e47315..cb59e9a048 100644 --- a/dtool/src/cppparser/cppInstance.cxx +++ b/dtool/src/cppparser/cppInstance.cxx @@ -26,6 +26,8 @@ #include +using std::string; + /** * */ @@ -506,7 +508,7 @@ substitute_decl(CPPDeclaration::SubstDecl &subst, * */ void CPPInstance:: -output(ostream &out, int indent_level, CPPScope *scope, bool complete) const { +output(std::ostream &out, int indent_level, CPPScope *scope, bool complete) const { output(out, indent_level, scope, complete, -1); } @@ -515,7 +517,7 @@ output(ostream &out, int indent_level, CPPScope *scope, bool complete) const { * function prototype. See CPPFunctionType::output(). */ void CPPInstance:: -output(ostream &out, int indent_level, CPPScope *scope, bool complete, +output(std::ostream &out, int indent_level, CPPScope *scope, bool complete, int num_default_parameters) const { assert(_type != nullptr); diff --git a/dtool/src/cppparser/cppInstanceIdentifier.cxx b/dtool/src/cppparser/cppInstanceIdentifier.cxx index b75dfc6424..878d751285 100644 --- a/dtool/src/cppparser/cppInstanceIdentifier.cxx +++ b/dtool/src/cppparser/cppInstanceIdentifier.cxx @@ -119,8 +119,8 @@ add_func_modifier(CPPParameterList *params, int flags, CPPType *trailing_return_ if (_ident != nullptr && _ident->get_simple_name().substr(0, 9) == "operator ") { - if (_ident->get_simple_name() != string("operator ()") && - _ident->get_simple_name() != string("operator []")) { + if (_ident->get_simple_name() != std::string("operator ()") && + _ident->get_simple_name() != std::string("operator []")) { if (params->_parameters.empty()) { flags |= CPPFunctionType::F_unary_op; } @@ -184,7 +184,7 @@ add_trailing_return_type(CPPType *type) { return; } } - cerr << "trailing return type can only be added to a function\n"; + std::cerr << "trailing return type can only be added to a function\n"; } /** @@ -296,7 +296,7 @@ r_unroll_type(CPPType *start_type, if (simple_type != nullptr && simple_type->_type == CPPSimpleType::T_auto) { return_type = mod._trailing_return_type; } else { - cerr << "function with trailing return type needs auto\n"; + std::cerr << "function with trailing return type needs auto\n"; } } result = new CPPFunctionType(return_type, mod._func_params, @@ -312,7 +312,7 @@ r_unroll_type(CPPType *start_type, break; default: - cerr << "Internal error--invalid CPPInstanceIdentifier\n"; + std::cerr << "Internal error--invalid CPPInstanceIdentifier\n"; abort(); } diff --git a/dtool/src/cppparser/cppInstanceIdentifier.h b/dtool/src/cppparser/cppInstanceIdentifier.h index 795677513e..6a2951d9cb 100644 --- a/dtool/src/cppparser/cppInstanceIdentifier.h +++ b/dtool/src/cppparser/cppInstanceIdentifier.h @@ -19,8 +19,6 @@ #include #include -using namespace std; - class CPPIdentifier; class CPPParameterList; class CPPType; diff --git a/dtool/src/cppparser/cppMakeProperty.cxx b/dtool/src/cppparser/cppMakeProperty.cxx index e75cfb5676..1846092eaa 100644 --- a/dtool/src/cppparser/cppMakeProperty.cxx +++ b/dtool/src/cppparser/cppMakeProperty.cxx @@ -38,7 +38,7 @@ CPPMakeProperty(CPPIdentifier *ident, Type type, /** * */ -string CPPMakeProperty:: +std::string CPPMakeProperty:: get_simple_name() const { return _ident->get_simple_name(); } @@ -46,7 +46,7 @@ get_simple_name() const { /** * */ -string CPPMakeProperty:: +std::string CPPMakeProperty:: get_local_name(CPPScope *scope) const { return _ident->get_local_name(scope); } @@ -54,7 +54,7 @@ get_local_name(CPPScope *scope) const { /** * */ -string CPPMakeProperty:: +std::string CPPMakeProperty:: get_fully_scoped_name() const { return _ident->get_fully_scoped_name(); } @@ -63,7 +63,7 @@ get_fully_scoped_name() const { * */ void CPPMakeProperty:: -output(ostream &out, int indent_level, CPPScope *scope, bool complete) const { +output(std::ostream &out, int indent_level, CPPScope *scope, bool complete) const { if (_length_function != nullptr) { out << "__make_seq_property"; } else { diff --git a/dtool/src/cppparser/cppMakeSeq.cxx b/dtool/src/cppparser/cppMakeSeq.cxx index d9b5ac7fcd..b032d367bb 100644 --- a/dtool/src/cppparser/cppMakeSeq.cxx +++ b/dtool/src/cppparser/cppMakeSeq.cxx @@ -32,7 +32,7 @@ CPPMakeSeq(CPPIdentifier *ident, /** * */ -string CPPMakeSeq:: +std::string CPPMakeSeq:: get_simple_name() const { return _ident->get_simple_name(); } @@ -40,7 +40,7 @@ get_simple_name() const { /** * */ -string CPPMakeSeq:: +std::string CPPMakeSeq:: get_local_name(CPPScope *scope) const { return _ident->get_local_name(scope); } @@ -48,7 +48,7 @@ get_local_name(CPPScope *scope) const { /** * */ -string CPPMakeSeq:: +std::string CPPMakeSeq:: get_fully_scoped_name() const { return _ident->get_fully_scoped_name(); } @@ -57,7 +57,7 @@ get_fully_scoped_name() const { * */ void CPPMakeSeq:: -output(ostream &out, int indent_level, CPPScope *scope, bool complete) const { +output(std::ostream &out, int indent_level, CPPScope *scope, bool complete) const { out << "__make_seq(" << _ident->get_local_name(scope) << ", " << _length_getter->_name << ", " << _element_getter->_name diff --git a/dtool/src/cppparser/cppManifest.cxx b/dtool/src/cppparser/cppManifest.cxx index faaaced2d8..2fc85783a7 100644 --- a/dtool/src/cppparser/cppManifest.cxx +++ b/dtool/src/cppparser/cppManifest.cxx @@ -16,6 +16,8 @@ #include +using std::string; + /** * */ @@ -252,7 +254,7 @@ determine_type() const { * */ void CPPManifest:: -output(ostream &out) const { +output(std::ostream &out) const { out << _name; if (_has_parameters) { diff --git a/dtool/src/cppparser/cppNameComponent.cxx b/dtool/src/cppparser/cppNameComponent.cxx index b5c7f825aa..1c8e4df88b 100644 --- a/dtool/src/cppparser/cppNameComponent.cxx +++ b/dtool/src/cppparser/cppNameComponent.cxx @@ -14,6 +14,8 @@ #include "cppNameComponent.h" #include "cppTemplateParameterList.h" +using std::string; + /** * */ @@ -83,7 +85,7 @@ get_name() const { */ string CPPNameComponent:: get_name_with_templ(CPPScope *scope) const { - ostringstream strm; + std::ostringstream strm; strm << _name; if (_templ != nullptr) { strm << "< "; @@ -157,7 +159,7 @@ set_templ(CPPTemplateParameterList *templ) { * */ void CPPNameComponent:: -output(ostream &out) const { +output(std::ostream &out) const { out << _name; if (_templ != nullptr) { out << "< " << *_templ << " >"; diff --git a/dtool/src/cppparser/cppNameComponent.h b/dtool/src/cppparser/cppNameComponent.h index cdeb293fca..a33de22a39 100644 --- a/dtool/src/cppparser/cppNameComponent.h +++ b/dtool/src/cppparser/cppNameComponent.h @@ -19,8 +19,6 @@ #include -using namespace std; - class CPPTemplateParameterList; class CPPScope; diff --git a/dtool/src/cppparser/cppNamespace.cxx b/dtool/src/cppparser/cppNamespace.cxx index c8e84a3725..9a6f608f49 100644 --- a/dtool/src/cppparser/cppNamespace.cxx +++ b/dtool/src/cppparser/cppNamespace.cxx @@ -31,7 +31,7 @@ CPPNamespace(CPPIdentifier *ident, CPPScope *scope, const CPPFile &file) : /** * */ -string CPPNamespace:: +std::string CPPNamespace:: get_simple_name() const { if (_ident == nullptr) { return ""; @@ -42,7 +42,7 @@ get_simple_name() const { /** * */ -string CPPNamespace:: +std::string CPPNamespace:: get_local_name(CPPScope *scope) const { if (_ident == nullptr) { return ""; @@ -53,7 +53,7 @@ get_local_name(CPPScope *scope) const { /** * */ -string CPPNamespace:: +std::string CPPNamespace:: get_fully_scoped_name() const { if (_ident == nullptr) { return ""; @@ -73,7 +73,7 @@ get_scope() const { * */ void CPPNamespace:: -output(ostream &out, int indent_level, CPPScope *scope, bool complete) const { +output(std::ostream &out, int indent_level, CPPScope *scope, bool complete) const { if (_is_inline) { out << "inline "; } diff --git a/dtool/src/cppparser/cppParameterList.cxx b/dtool/src/cppparser/cppParameterList.cxx index 6ecdbc665d..4fc5198b6e 100644 --- a/dtool/src/cppparser/cppParameterList.cxx +++ b/dtool/src/cppparser/cppParameterList.cxx @@ -198,7 +198,7 @@ resolve_type(CPPScope *current_scope, CPPScope *global_scope) { * shown. */ void CPPParameterList:: -output(ostream &out, CPPScope *scope, bool parameter_names, +output(std::ostream &out, CPPScope *scope, bool parameter_names, int num_default_parameters) const { if (!_parameters.empty()) { for (int i = 0; i < (int)_parameters.size(); ++i) { diff --git a/dtool/src/cppparser/cppParser.cxx b/dtool/src/cppparser/cppParser.cxx index 6b13d95dec..f236a238c9 100644 --- a/dtool/src/cppparser/cppParser.cxx +++ b/dtool/src/cppparser/cppParser.cxx @@ -59,7 +59,7 @@ parse_file(const Filename &filename) { } if (!init_cpp(file)) { - cerr << "Unable to read " << filename << "\n"; + std::cerr << "Unable to read " << filename << "\n"; return false; } parse_cpp(this); @@ -72,7 +72,7 @@ parse_file(const Filename &filename) { * an expression. Returns NULL if the string is not a valid expression. */ CPPExpression *CPPParser:: -parse_expr(const string &expr) { +parse_expr(const std::string &expr) { YYLTYPE loc = {}; return CPPPreprocessor::parse_expr(expr, this, this, loc); } @@ -82,7 +82,7 @@ parse_expr(const string &expr) { * CPPType. Returns NULL if the string is not a valid type. */ CPPType *CPPParser:: -parse_type(const string &type) { +parse_type(const std::string &type) { CPPTypeParser ep(this, this); ep._verbose = 0; if (ep.parse_type(type, *this)) { diff --git a/dtool/src/cppparser/cppPointerType.cxx b/dtool/src/cppparser/cppPointerType.cxx index 9185455350..bba2a82333 100644 --- a/dtool/src/cppparser/cppPointerType.cxx +++ b/dtool/src/cppparser/cppPointerType.cxx @@ -205,7 +205,7 @@ is_equivalent(const CPPType &other) const { * */ void CPPPointerType:: -output(ostream &out, int indent_level, CPPScope *scope, bool complete) const { +output(std::ostream &out, int indent_level, CPPScope *scope, bool complete) const { /* CPPFunctionType *ftype = _pointing_at->as_function_type(); if (ftype != (CPPFunctionType *)NULL) { @@ -235,10 +235,10 @@ output(ostream &out, int indent_level, CPPScope *scope, bool complete) const { * have special exceptions. */ void CPPPointerType:: -output_instance(ostream &out, int indent_level, CPPScope *scope, - bool complete, const string &prename, - const string &name) const { - string star = "*"; +output_instance(std::ostream &out, int indent_level, CPPScope *scope, + bool complete, const std::string &prename, + const std::string &name) const { + std::string star = "*"; CPPFunctionType *ftype = _pointing_at->as_function_type(); if (ftype != nullptr && diff --git a/dtool/src/cppparser/cppPreprocessor.cxx b/dtool/src/cppparser/cppPreprocessor.cxx index 2a6c3270bc..24784a98c8 100644 --- a/dtool/src/cppparser/cppPreprocessor.cxx +++ b/dtool/src/cppparser/cppPreprocessor.cxx @@ -35,6 +35,9 @@ #include #include +using std::cerr; +using std::string; + // We manage our own visibility counter, in addition to that managed by // cppBison.y. We do this just so we can define manifests with the correct // visibility when they are declared. (Asking the parser for the current @@ -137,7 +140,7 @@ connect_input(const string &input) { assert(_in == nullptr); _input = input; - _in = new istringstream(_input); + _in = new std::istringstream(_input); return !_in->fail(); } @@ -1491,7 +1494,7 @@ handle_define_directive(const string &args, const YYLTYPE &loc) { } } - pair result = + std::pair result = _manifests.insert(Manifests::value_type(manifest->_name, manifest)); if (!result.second) { @@ -1555,7 +1558,7 @@ handle_if_directive(const string &args, const YYLTYPE &loc) { if (ep.parse_expr(expr, *this)) { CPPExpression::Result result = ep._expr->evaluate(); if (result._type == CPPExpression::RT_error) { - ostringstream strm; + std::ostringstream strm; strm << *ep._expr; warning("Ignoring invalid expression " + strm.str(), loc); } else { diff --git a/dtool/src/cppparser/cppReferenceType.cxx b/dtool/src/cppparser/cppReferenceType.cxx index 0b351c830e..42526789a3 100644 --- a/dtool/src/cppparser/cppReferenceType.cxx +++ b/dtool/src/cppparser/cppReferenceType.cxx @@ -210,7 +210,7 @@ is_equivalent(const CPPType &other) const { * */ void CPPReferenceType:: -output(ostream &out, int indent_level, CPPScope *scope, bool complete) const { +output(std::ostream &out, int indent_level, CPPScope *scope, bool complete) const { /* _pointing_at->output(out, indent_level, scope, complete); out << " &"; @@ -224,9 +224,9 @@ output(ostream &out, int indent_level, CPPScope *scope, bool complete) const { * have special exceptions. */ void CPPReferenceType:: -output_instance(ostream &out, int indent_level, CPPScope *scope, - bool complete, const string &prename, - const string &name) const { +output_instance(std::ostream &out, int indent_level, CPPScope *scope, + bool complete, const std::string &prename, + const std::string &name) const { if (_value_category == VC_rvalue) { _pointing_at->output_instance(out, indent_level, scope, complete, diff --git a/dtool/src/cppparser/cppScope.cxx b/dtool/src/cppparser/cppScope.cxx index 878daa8812..af6404e4dd 100644 --- a/dtool/src/cppparser/cppScope.cxx +++ b/dtool/src/cppparser/cppScope.cxx @@ -33,6 +33,11 @@ #include "cppBisonDefs.h" #include "indent.h" +using std::ostream; +using std::ostringstream; +using std::pair; +using std::string; + /** * */ diff --git a/dtool/src/cppparser/cppScope.h b/dtool/src/cppparser/cppScope.h index 44fcc25fef..2631d6097a 100644 --- a/dtool/src/cppparser/cppScope.h +++ b/dtool/src/cppparser/cppScope.h @@ -25,8 +25,6 @@ #include #include -using namespace std; - class CPPType; class CPPDeclaration; class CPPExtensionType; diff --git a/dtool/src/cppparser/cppSimpleType.cxx b/dtool/src/cppparser/cppSimpleType.cxx index 321e76c3cd..1ed364a175 100644 --- a/dtool/src/cppparser/cppSimpleType.cxx +++ b/dtool/src/cppparser/cppSimpleType.cxx @@ -133,7 +133,7 @@ is_parameter_expr() const { /** * */ -string CPPSimpleType:: +std::string CPPSimpleType:: get_preferred_name() const { // Simple types always prefer to use their native types. return get_local_name(); @@ -143,7 +143,7 @@ get_preferred_name() const { * */ void CPPSimpleType:: -output(ostream &out, int, CPPScope *, bool) const { +output(std::ostream &out, int, CPPScope *, bool) const { if (_flags & F_unsigned) { out << "unsigned "; } diff --git a/dtool/src/cppparser/cppStructType.cxx b/dtool/src/cppparser/cppStructType.cxx index 25337642a0..aba4bdbb60 100644 --- a/dtool/src/cppparser/cppStructType.cxx +++ b/dtool/src/cppparser/cppStructType.cxx @@ -28,7 +28,7 @@ * */ void CPPStructType::Base:: -output(ostream &out) const { +output(std::ostream &out) const { if (_is_virtual) { out << "virtual "; } @@ -1240,7 +1240,7 @@ substitute_decl(CPPDeclaration::SubstDecl &subst, * */ void CPPStructType:: -output(ostream &out, int indent_level, CPPScope *scope, bool complete) const { +output(std::ostream &out, int indent_level, CPPScope *scope, bool complete) const { if (!complete && _ident != nullptr) { // If we have a name, use it. if (cppparser_output_class_keyword) { @@ -1351,7 +1351,7 @@ get_virtual_funcs(VFunctions &funcs) const { } else { // Non-destructors we can try to match up by name. - string fname = inst->get_local_name(); + std::string fname = inst->get_local_name(); CPPScope::Functions::const_iterator fi; fi = _scope->_functions.find(fname); diff --git a/dtool/src/cppparser/cppTBDType.cxx b/dtool/src/cppparser/cppTBDType.cxx index 664787cbe6..5c583453ca 100644 --- a/dtool/src/cppparser/cppTBDType.cxx +++ b/dtool/src/cppparser/cppTBDType.cxx @@ -56,7 +56,7 @@ is_tbd() const { * include any scoping operators or template parameters, so it may not be a * compilable reference to the type. */ -string CPPTBDType:: +std::string CPPTBDType:: get_simple_name() const { return _ident->get_simple_name(); } @@ -65,7 +65,7 @@ get_simple_name() const { * Returns the compilable, correct name for this type within the indicated * scope. If the scope is NULL, within the scope the type is declared in. */ -string CPPTBDType:: +std::string CPPTBDType:: get_local_name(CPPScope *scope) const { return _ident->get_local_name(scope); } @@ -74,7 +74,7 @@ get_local_name(CPPScope *scope) const { * Returns the compilable, correct name for the type, with completely explicit * scoping. */ -string CPPTBDType:: +std::string CPPTBDType:: get_fully_scoped_name() const { return _ident->get_fully_scoped_name(); } @@ -128,7 +128,7 @@ substitute_decl(CPPDeclaration::SubstDecl &subst, * */ void CPPTBDType:: -output(ostream &out, int, CPPScope *, bool) const { +output(std::ostream &out, int, CPPScope *, bool) const { out /* << "typename " */ << *_ident; } diff --git a/dtool/src/cppparser/cppTemplateParameterList.cxx b/dtool/src/cppparser/cppTemplateParameterList.cxx index 24ee70e9e4..fd12967711 100644 --- a/dtool/src/cppparser/cppTemplateParameterList.cxx +++ b/dtool/src/cppparser/cppTemplateParameterList.cxx @@ -26,9 +26,9 @@ CPPTemplateParameterList() { /** * */ -string CPPTemplateParameterList:: +std::string CPPTemplateParameterList:: get_string() const { - ostringstream strname; + std::ostringstream strname; strname << "< " << *this << " >"; return strname.str(); } @@ -197,7 +197,7 @@ substitute_decl(CPPDeclaration::SubstDecl &subst, * */ void CPPTemplateParameterList:: -output(ostream &out, CPPScope *scope) const { +output(std::ostream &out, CPPScope *scope) const { if (!_parameters.empty()) { Parameters::const_iterator pi = _parameters.begin(); (*pi)->output(out, 0, scope, false); @@ -217,7 +217,7 @@ output(ostream &out, CPPScope *scope) const { * trailing newline. */ void CPPTemplateParameterList:: -write_formal(ostream &out, CPPScope *scope) const { +write_formal(std::ostream &out, CPPScope *scope) const { out << "template<"; if (!_parameters.empty()) { Parameters::const_iterator pi = _parameters.begin(); diff --git a/dtool/src/cppparser/cppTemplateScope.cxx b/dtool/src/cppparser/cppTemplateScope.cxx index 34482ad64b..a71c176005 100644 --- a/dtool/src/cppparser/cppTemplateScope.cxx +++ b/dtool/src/cppparser/cppTemplateScope.cxx @@ -17,6 +17,8 @@ #include "cppIdentifier.h" #include "cppTypedefType.h" +using std::string; + /** * */ @@ -154,7 +156,7 @@ get_fully_scoped_name() const { * */ void CPPTemplateScope:: -output(ostream &out, CPPScope *scope) const { +output(std::ostream &out, CPPScope *scope) const { CPPScope::output(out, scope); out << "< "; _parameters.output(out, scope); diff --git a/dtool/src/cppparser/cppToken.cxx b/dtool/src/cppparser/cppToken.cxx index 8504150bbd..5649d4a612 100644 --- a/dtool/src/cppparser/cppToken.cxx +++ b/dtool/src/cppparser/cppToken.cxx @@ -23,7 +23,7 @@ */ CPPToken:: CPPToken(int token, int line_number, int col_number, - const CPPFile &file, const string &str, + const CPPFile &file, const std::string &str, const YYSTYPE &lval) : _token(token), _lval(lval) { @@ -39,7 +39,7 @@ CPPToken(int token, int line_number, int col_number, * */ CPPToken:: -CPPToken(int token, const YYLTYPE &loc, const string &str, const YYSTYPE &val) : +CPPToken(int token, const YYLTYPE &loc, const std::string &str, const YYSTYPE &val) : _token(token), _lval(val), _lloc(loc) { _lval.str = str; @@ -90,7 +90,7 @@ is_eof() const { * */ void CPPToken:: -output(ostream &out) const { +output(std::ostream &out) const { switch (_token) { case REAL: out << "REAL " << _lval.u.real; diff --git a/dtool/src/cppparser/cppType.cxx b/dtool/src/cppparser/cppType.cxx index 26581c7205..eea6f47bf6 100644 --- a/dtool/src/cppparser/cppType.cxx +++ b/dtool/src/cppparser/cppType.cxx @@ -20,6 +20,8 @@ #include "cppExtensionType.h" #include +using std::string; + CPPType::Types CPPType::_types; CPPType::PreferredNames CPPType::_preferred_names; CPPType::AltNames CPPType::_alt_names; @@ -306,7 +308,7 @@ get_simple_name() const { */ string CPPType:: get_local_name(CPPScope *scope) const { - ostringstream ostrm; + std::ostringstream ostrm; output(ostrm, 0, scope, false); return ostrm.str(); } @@ -419,7 +421,7 @@ is_convertible_to(const CPPType *other) const { * have special exceptions. */ void CPPType:: -output_instance(ostream &out, const string &name, CPPScope *scope) const { +output_instance(std::ostream &out, const string &name, CPPScope *scope) const { output_instance(out, 0, scope, false, "", name); } @@ -429,7 +431,7 @@ output_instance(ostream &out, const string &name, CPPScope *scope) const { * have special exceptions. */ void CPPType:: -output_instance(ostream &out, int indent_level, CPPScope *scope, +output_instance(std::ostream &out, int indent_level, CPPScope *scope, bool complete, const string &prename, const string &name) const { output(out, indent_level, scope, complete); @@ -454,7 +456,7 @@ as_type() { */ CPPType *CPPType:: new_type(CPPType *type) { - pair result = _types.insert(type); + std::pair result = _types.insert(type); if (result.second) { // The insertion has taken place; thus, this is the first time this type // has been declared. diff --git a/dtool/src/cppparser/cppTypeDeclaration.cxx b/dtool/src/cppparser/cppTypeDeclaration.cxx index 23c72cd2d0..84b6075172 100644 --- a/dtool/src/cppparser/cppTypeDeclaration.cxx +++ b/dtool/src/cppparser/cppTypeDeclaration.cxx @@ -46,7 +46,7 @@ substitute_decl(CPPDeclaration::SubstDecl &subst, * */ void CPPTypeDeclaration:: -output(ostream &out, int indent_level, CPPScope *scope, bool) const { +output(std::ostream &out, int indent_level, CPPScope *scope, bool) const { _type->output(out, indent_level, scope, true); } diff --git a/dtool/src/cppparser/cppTypeParser.cxx b/dtool/src/cppparser/cppTypeParser.cxx index b88a1a079d..cdaa1d0288 100644 --- a/dtool/src/cppparser/cppTypeParser.cxx +++ b/dtool/src/cppparser/cppTypeParser.cxx @@ -36,9 +36,9 @@ CPPTypeParser:: * */ bool CPPTypeParser:: -parse_type(const string &type) { +parse_type(const std::string &type) { if (!init_type(type)) { - cerr << "Unable to parse type\n"; + std::cerr << "Unable to parse type\n"; return false; } @@ -51,9 +51,9 @@ parse_type(const string &type) { * */ bool CPPTypeParser:: -parse_type(const string &type, const CPPPreprocessor &filepos) { +parse_type(const std::string &type, const CPPPreprocessor &filepos) { if (!init_type(type)) { - cerr << "Unable to parse type\n"; + std::cerr << "Unable to parse type\n"; return false; } @@ -68,7 +68,7 @@ parse_type(const string &type, const CPPPreprocessor &filepos) { * */ void CPPTypeParser:: -output(ostream &out) const { +output(std::ostream &out) const { if (_type == nullptr) { out << "(null type)"; } else { diff --git a/dtool/src/cppparser/cppTypeProxy.cxx b/dtool/src/cppparser/cppTypeProxy.cxx index fe6bfb7c05..4843ac5b34 100644 --- a/dtool/src/cppparser/cppTypeProxy.cxx +++ b/dtool/src/cppparser/cppTypeProxy.cxx @@ -14,6 +14,8 @@ #include "cppTypeProxy.h" #include "cppFile.h" +using std::string; + /** * */ @@ -144,7 +146,7 @@ is_incomplete() const { * have special exceptions. */ void CPPTypeProxy:: -output_instance(ostream &out, int indent_level, CPPScope *scope, +output_instance(std::ostream &out, int indent_level, CPPScope *scope, bool complete, const string &prename, const string &name) const { if (_actual_type == nullptr) { @@ -159,7 +161,7 @@ output_instance(ostream &out, int indent_level, CPPScope *scope, * */ void CPPTypeProxy:: -output(ostream &out, int indent_level, CPPScope *scope, bool complete) const { +output(std::ostream &out, int indent_level, CPPScope *scope, bool complete) const { if (_actual_type == nullptr) { out << "unknown"; return; diff --git a/dtool/src/cppparser/cppTypedefType.cxx b/dtool/src/cppparser/cppTypedefType.cxx index 32d4c55865..6924fca4a0 100644 --- a/dtool/src/cppparser/cppTypedefType.cxx +++ b/dtool/src/cppparser/cppTypedefType.cxx @@ -17,6 +17,8 @@ #include "cppTemplateScope.h" #include "indent.h" +using std::string; + /** * */ @@ -373,7 +375,7 @@ is_equivalent(const CPPType &other) const { * */ void CPPTypedefType:: -output(ostream &out, int indent_level, CPPScope *scope, bool complete) const { +output(std::ostream &out, int indent_level, CPPScope *scope, bool complete) const { string name; if (_ident != nullptr) { name = _ident->get_local_name(scope); diff --git a/dtool/src/cppparser/cppUsing.cxx b/dtool/src/cppparser/cppUsing.cxx index 3611450de6..146f8f3f48 100644 --- a/dtool/src/cppparser/cppUsing.cxx +++ b/dtool/src/cppparser/cppUsing.cxx @@ -28,7 +28,7 @@ CPPUsing(CPPIdentifier *ident, bool full_namespace, const CPPFile &file) : * */ void CPPUsing:: -output(ostream &out, int, CPPScope *, bool) const { +output(std::ostream &out, int, CPPScope *, bool) const { out << "using "; if (_full_namespace) { out << "namespace "; diff --git a/dtool/src/cppparser/cppVisibility.cxx b/dtool/src/cppparser/cppVisibility.cxx index 6cee2a70f3..92273c00a3 100644 --- a/dtool/src/cppparser/cppVisibility.cxx +++ b/dtool/src/cppparser/cppVisibility.cxx @@ -13,8 +13,8 @@ #include "cppVisibility.h" -ostream & -operator << (ostream &out, CPPVisibility vis) { +std::ostream & +operator << (std::ostream &out, CPPVisibility vis) { switch (vis) { case V_published: return out << "__published"; diff --git a/dtool/src/dconfig/test_config.cxx b/dtool/src/dconfig/test_config.cxx index 40f27e7197..2374bd775e 100644 --- a/dtool/src/dconfig/test_config.cxx +++ b/dtool/src/dconfig/test_config.cxx @@ -13,6 +13,9 @@ #include "dconfig.h" +using std::cout; +using std::endl; + #define SNARF Configure(test); diff --git a/dtool/src/dconfig/test_expand.cxx b/dtool/src/dconfig/test_expand.cxx index 281e8b02ba..334bf2593d 100644 --- a/dtool/src/dconfig/test_expand.cxx +++ b/dtool/src/dconfig/test_expand.cxx @@ -14,6 +14,9 @@ #include "expand.h" #include +using std::cout; +using std::endl; + void TestExpandFunction() { std::string line; diff --git a/dtool/src/dconfig/test_pfstream.cxx b/dtool/src/dconfig/test_pfstream.cxx index 29874a97ac..9b211c2381 100644 --- a/dtool/src/dconfig/test_pfstream.cxx +++ b/dtool/src/dconfig/test_pfstream.cxx @@ -14,13 +14,13 @@ #include "pfstream.h" #include -void ReadIt(istream& ifs) { +void ReadIt(std::istream& ifs) { std::string line; while (!ifs.eof()) { std::getline(ifs, line); if (line.length() != 0) - cout << line << endl; + std::cout << line << std::endl; } } diff --git a/dtool/src/dconfig/test_searchpath.cxx b/dtool/src/dconfig/test_searchpath.cxx index edcb8a13cd..4abf1f71bd 100644 --- a/dtool/src/dconfig/test_searchpath.cxx +++ b/dtool/src/dconfig/test_searchpath.cxx @@ -15,6 +15,9 @@ // #include "expand.h" #include +using std::cout; +using std::endl; + void TestSearch() { std::string line, path; diff --git a/dtool/src/dtoolbase/deletedBufferChain.cxx b/dtool/src/dtoolbase/deletedBufferChain.cxx index 303c9f1223..d009510ad3 100644 --- a/dtool/src/dtoolbase/deletedBufferChain.cxx +++ b/dtool/src/dtoolbase/deletedBufferChain.cxx @@ -24,7 +24,7 @@ DeletedBufferChain(size_t buffer_size) { _buffer_size = buffer_size; // We must allocate at least this much space for bookkeeping reasons. - _buffer_size = max(_buffer_size, sizeof(ObjectNode)); + _buffer_size = std::max(_buffer_size, sizeof(ObjectNode)); } /** diff --git a/dtool/src/dtoolbase/dtoolbase_cc.h b/dtool/src/dtoolbase/dtoolbase_cc.h index db12cc8737..b4ce1d597c 100644 --- a/dtool/src/dtoolbase/dtoolbase_cc.h +++ b/dtool/src/dtoolbase/dtoolbase_cc.h @@ -158,36 +158,6 @@ namespace std { #endif // CPPPARSER -// This was previously `using namespace std`, but we don't want to pull in the -// entire namespace, so we enumerate the things we are using without std:: -// prefix in the Panda headers. It is intended that this list will shrink. -using std::cerr; -using std::cin; -using std::cout; -using std::dec; -using std::endl; -using std::hex; -using std::ios; -using std::iostream; -using std::istream; -using std::istringstream; -using std::max; -using std::min; -using std::move; -using std::ostream; -using std::ostringstream; -using std::pair; -using std::setfill; -using std::setw; -using std::streambuf; -using std::streamoff; -using std::streampos; -using std::streamsize; -using std::string; -using std::stringstream; -using std::swap; -using std::wstring; - // The ReferenceCount class is defined later, within Panda, but we need to // pass around forward references to it here at the very low level. class ReferenceCount; diff --git a/dtool/src/dtoolbase/indent.cxx b/dtool/src/dtoolbase/indent.cxx index bf33828d03..df66a47197 100644 --- a/dtool/src/dtoolbase/indent.cxx +++ b/dtool/src/dtoolbase/indent.cxx @@ -16,8 +16,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 << ' '; } diff --git a/dtool/src/dtoolbase/memoryHook.cxx b/dtool/src/dtoolbase/memoryHook.cxx index 82ee8dc037..24d5f11a11 100644 --- a/dtool/src/dtoolbase/memoryHook.cxx +++ b/dtool/src/dtoolbase/memoryHook.cxx @@ -37,6 +37,8 @@ #endif // WIN32 +using std::cerr; + // Ensure we made the right decisions about the alignment size. static_assert(MEMORY_HOOK_ALIGNMENT >= sizeof(size_t), "MEMORY_HOOK_ALIGNMENT should at least be sizeof(size_t)"); @@ -423,7 +425,7 @@ heap_realloc_array(void *ptr, size_t size) { size_t orig_delta = (char *)ptr - (char *)alloc; size_t new_delta = (char *)ptr1 - (char *)alloc1; if (orig_delta != new_delta) { - memmove((char *)alloc1 + new_delta, (char *)alloc1 + orig_delta, min(size, orig_size)); + memmove((char *)alloc1 + new_delta, (char *)alloc1 + orig_delta, std::min(size, orig_size)); } root[-2] = size; diff --git a/dtool/src/dtoolbase/neverFreeMemory.cxx b/dtool/src/dtoolbase/neverFreeMemory.cxx index b933007dd5..bd7c1c1481 100644 --- a/dtool/src/dtoolbase/neverFreeMemory.cxx +++ b/dtool/src/dtoolbase/neverFreeMemory.cxx @@ -61,7 +61,7 @@ ns_alloc(size_t size) { // We have to allocate a new page. Allocate at least min_page_size bytes, // and then round that up to the next _page_size bytes. - size_t needed_size = max(size, min_page_size); + size_t needed_size = std::max(size, min_page_size); needed_size = memory_hook->round_up_to_page_size(needed_size); void *start = memory_hook->mmap_alloc(needed_size, false); _total_alloc += needed_size; diff --git a/dtool/src/dtoolbase/pallocator.h b/dtool/src/dtoolbase/pallocator.h index b5158810df..d61ca64ceb 100644 --- a/dtool/src/dtoolbase/pallocator.h +++ b/dtool/src/dtoolbase/pallocator.h @@ -20,8 +20,6 @@ #include "deletedChain.h" #include "typeHandle.h" -using std::allocator; - /** * This is our own Panda specialization on the default STL allocator. Its * main purpose is to call the hooks for MemoryUsage to properly track STL- diff --git a/dtool/src/dtoolbase/pdeque.h b/dtool/src/dtoolbase/pdeque.h index b4c71c81eb..e7e9f96c28 100644 --- a/dtool/src/dtoolbase/pdeque.h +++ b/dtool/src/dtoolbase/pdeque.h @@ -27,8 +27,6 @@ #else -using std::deque; - /** * This is our own Panda specialization on the default STL deque. Its main * purpose is to call the hooks for MemoryUsage to properly track STL- diff --git a/dtool/src/dtoolbase/plist.h b/dtool/src/dtoolbase/plist.h index 0ddef3c9f1..12d29880f3 100644 --- a/dtool/src/dtoolbase/plist.h +++ b/dtool/src/dtoolbase/plist.h @@ -26,8 +26,6 @@ #else -using std::list; - /** * This is our own Panda specialization on the default STL list. Its main * purpose is to call the hooks for MemoryUsage to properly track STL- diff --git a/dtool/src/dtoolbase/pmap.h b/dtool/src/dtoolbase/pmap.h index 0f960ac9d5..6ddb38edee 100644 --- a/dtool/src/dtoolbase/pmap.h +++ b/dtool/src/dtoolbase/pmap.h @@ -40,9 +40,6 @@ #else // USE_STL_ALLOCATOR -using std::map; -using std::multimap; - /** * This is our own Panda specialization on the default STL map. Its main * purpose is to call the hooks for MemoryUsage to properly track STL- diff --git a/dtool/src/dtoolbase/pset.h b/dtool/src/dtoolbase/pset.h index 7b51cf787d..ff54486dfe 100644 --- a/dtool/src/dtoolbase/pset.h +++ b/dtool/src/dtoolbase/pset.h @@ -40,9 +40,6 @@ #else // USE_STL_ALLOCATOR -using std::set; -using std::multiset; - /** * This is our own Panda specialization on the default STL set. Its main * purpose is to call the hooks for MemoryUsage to properly track STL- diff --git a/dtool/src/dtoolbase/pvector.h b/dtool/src/dtoolbase/pvector.h index f88b625bca..4199506d13 100644 --- a/dtool/src/dtoolbase/pvector.h +++ b/dtool/src/dtoolbase/pvector.h @@ -33,8 +33,6 @@ class pvector : public std::vector { #else -using std::vector; - /** * This is our own Panda specialization on the default STL vector. Its main * purpose is to call the hooks for MemoryUsage to properly track STL- diff --git a/dtool/src/dtoolbase/test_strtod.cxx b/dtool/src/dtoolbase/test_strtod.cxx index 169e90bfcf..1071a89273 100644 --- a/dtool/src/dtoolbase/test_strtod.cxx +++ b/dtool/src/dtoolbase/test_strtod.cxx @@ -26,9 +26,9 @@ main(int argc, char *argv[]) { for (int i = 1; i < argc; ++i) { char *endptr = nullptr; double result = pstrtod(argv[i], &endptr); - cerr << "pstrtod - " << argv[i] << " : " << result << " : " << endptr << "\n"; + std::cerr << "pstrtod - " << argv[i] << " : " << result << " : " << endptr << "\n"; result = strtod(argv[i], &endptr); - cerr << "strtod - " << argv[i] << " : " << result << " : " << endptr << "\n"; + std::cerr << "strtod - " << argv[i] << " : " << result << " : " << endptr << "\n"; } return 0; diff --git a/dtool/src/dtoolbase/typeHandle.cxx b/dtool/src/dtoolbase/typeHandle.cxx index c3cad42e8c..1b96352723 100644 --- a/dtool/src/dtoolbase/typeHandle.cxx +++ b/dtool/src/dtoolbase/typeHandle.cxx @@ -55,7 +55,7 @@ inc_memory_usage(MemoryClass memory_class, size_t size) { // cerr << *this << ".inc(" << memory_class << ", " << size << ") -> " << // rnode->_memory_usage[memory_class] << "\n"; if (rnode->_memory_usage[memory_class] < 0) { - cerr << "Memory usage overflow for type " << rnode->_name << ".\n"; + std::cerr << "Memory usage overflow for type " << rnode->_name << ".\n"; abort(); } } @@ -102,7 +102,7 @@ allocate_array(size_t size) { assert(rnode != nullptr); AtomicAdjust::add(rnode->_memory_usage[MC_array], (AtomicAdjust::Integer)alloc_size); if (rnode->_memory_usage[MC_array] < 0) { - cerr << "Memory usage overflow for type " << rnode->_name << ".\n"; + std::cerr << "Memory usage overflow for type " << rnode->_name << ".\n"; abort(); } } @@ -175,8 +175,8 @@ get_best_parent_from_Set(const std::set< int > &legal_vals) const { return -1; } -ostream & -operator << (ostream &out, TypeHandle::MemoryClass mem_class) { +std::ostream & +operator << (std::ostream &out, TypeHandle::MemoryClass mem_class) { switch (mem_class) { case TypeHandle::MC_singleton: return out << "singleton"; diff --git a/dtool/src/dtoolbase/typeRegistry.cxx b/dtool/src/dtoolbase/typeRegistry.cxx index d7077727e1..23cdb5ebfb 100644 --- a/dtool/src/dtoolbase/typeRegistry.cxx +++ b/dtool/src/dtoolbase/typeRegistry.cxx @@ -20,6 +20,11 @@ #include +using std::cerr; +using std::ostream; +using std::ostringstream; +using std::string; + MutexImpl *TypeRegistry::_lock = nullptr; TypeRegistry *TypeRegistry::_global_pointer = nullptr; diff --git a/dtool/src/dtoolbase/typeRegistryNode.cxx b/dtool/src/dtoolbase/typeRegistryNode.cxx index 6d8d85ffc5..f809ddcc0b 100644 --- a/dtool/src/dtoolbase/typeRegistryNode.cxx +++ b/dtool/src/dtoolbase/typeRegistryNode.cxx @@ -22,7 +22,7 @@ bool TypeRegistryNode::_paranoid_inheritance = false; * */ TypeRegistryNode:: -TypeRegistryNode(TypeHandle handle, const string &name, TypeHandle &ref) : +TypeRegistryNode(TypeHandle handle, const std::string &name, TypeHandle &ref) : _handle(handle), _name(name), _ref(ref) { clear_subtree(); @@ -54,19 +54,19 @@ is_derived_from(const TypeRegistryNode *child, const TypeRegistryNode *base) { if (_paranoid_inheritance) { bool paranoid_derives = check_derived_from(child, base); if (derives != paranoid_derives) { - cerr + std::cerr << "Inheritance test for " << child->_name << " from " << base->_name << " failed!\n" << "Result: " << derives << " should have been: " << paranoid_derives << "\n" << "Classes are in the same single inheritance subtree, children of " << child->_inherit._top->_name << "\n" - << hex + << std::hex << child->_name << " has mask " << child->_inherit._mask << " and bits " << child->_inherit._bits << "\n" << base->_name << " has mask " << base->_inherit._mask << " and bits " << base->_inherit._bits << "\n" - << dec; + << std::dec; return paranoid_derives; } } @@ -118,7 +118,7 @@ is_derived_from(const TypeRegistryNode *child, const TypeRegistryNode *base) { if (_paranoid_inheritance) { bool paranoid_derives = check_derived_from(child, base); if (derives != paranoid_derives) { - cerr + std::cerr << "Inheritance test for " << child->_name << " from " << base->_name << " failed!\n" << "Result: " << derives << " should have been: " @@ -280,7 +280,7 @@ r_build_subtrees(TypeRegistryNode *top, int bit_count, // We need at least one bit, even if there is only one child, so we can // differentiate parent from child. - more_bits = max(more_bits, 1); + more_bits = std::max(more_bits, 1); assert(more_bits < (int)(sizeof(SubtreeMaskType) * 8)); diff --git a/dtool/src/dtoolbase/typedObject.cxx b/dtool/src/dtoolbase/typedObject.cxx index a397ef843e..73a2cfc9c2 100644 --- a/dtool/src/dtoolbase/typedObject.cxx +++ b/dtool/src/dtoolbase/typedObject.cxx @@ -31,7 +31,7 @@ get_type() const { // Normally, this function should never be called, because it is a pure // virtual function. If it is called, you probably called get_type() on a // recently-destructed object. - cerr + std::cerr << "TypedObject::get_type() called!\n"; return _type_handle; } diff --git a/dtool/src/dtoolutil/dSearchPath.cxx b/dtool/src/dtoolutil/dSearchPath.cxx index f30f2156fc..4a094f1d98 100644 --- a/dtool/src/dtoolutil/dSearchPath.cxx +++ b/dtool/src/dtoolutil/dSearchPath.cxx @@ -17,6 +17,9 @@ #include #include +using std::ostream; +using std::string; + /** * */ diff --git a/dtool/src/dtoolutil/executionEnvironment.cxx b/dtool/src/dtoolutil/executionEnvironment.cxx index a2baf28343..4152a8c356 100644 --- a/dtool/src/dtoolutil/executionEnvironment.cxx +++ b/dtool/src/dtoolutil/executionEnvironment.cxx @@ -18,6 +18,9 @@ #include #include // for perror +using std::cerr; +using std::string; + #ifdef __APPLE__ #include // for realpath #endif // __APPLE__ @@ -554,7 +557,7 @@ read_args() { wchar_t buffer[buffer_size]; DWORD size = GetModuleFileNameW(dllhandle, buffer, buffer_size); if (size != 0) { - Filename tmp = Filename::from_os_specific_w(wstring(buffer, size)); + Filename tmp = Filename::from_os_specific_w(std::wstring(buffer, size)); tmp.make_true_case(); _dtool_name = tmp; } @@ -654,7 +657,7 @@ read_args() { wchar_t buffer[buffer_size]; DWORD size = GetModuleFileNameW(nullptr, buffer, buffer_size); if (size != 0) { - Filename tmp = Filename::from_os_specific_w(wstring(buffer, size)); + Filename tmp = Filename::from_os_specific_w(std::wstring(buffer, size)); tmp.make_true_case(); _binary_name = tmp; } @@ -727,7 +730,7 @@ read_args() { encoder.set_encoding(Filename::get_filesystem_encoding()); for (int i = 0; i < argc; ++i) { - wstring wtext(wargv[i]); + std::wstring wtext(wargv[i]); encoder.set_wtext(wtext); if (i == 0) { diff --git a/dtool/src/dtoolutil/filename.cxx b/dtool/src/dtoolutil/filename.cxx index 61816e7a44..da5657dd9d 100644 --- a/dtool/src/dtoolutil/filename.cxx +++ b/dtool/src/dtoolutil/filename.cxx @@ -53,6 +53,11 @@ #include #endif +using std::cerr; +using std::ios; +using std::string; +using std::wstring; + TextEncoder::Encoding Filename::_filesystem_encoding = TextEncoder::E_utf8; TVOLATILE AtomicAdjust::Pointer Filename::_home_directory; @@ -832,9 +837,9 @@ get_filename_index(int index) const { Filename file(*this); if (_hash_end != _hash_start) { - ostringstream strm; + std::ostringstream strm; strm << _filename.substr(0, _hash_start) - << setw((int)(_hash_end - _hash_start)) << setfill('0') << index + << std::setw((int)(_hash_end - _hash_start)) << std::setfill('0') << index << _filename.substr(_hash_end); file.set_fullpath(strm.str()); } @@ -1542,7 +1547,7 @@ get_access_timestamp() const { /** * Returns the size of the file in bytes, or 0 if there is an error. */ -streamsize Filename:: +std::streamsize Filename:: get_file_size() const { #ifdef WIN32_VC wstring os_specific = get_filename_index(0).to_os_specific_w(); diff --git a/dtool/src/dtoolutil/filename_assist.mm b/dtool/src/dtoolutil/filename_assist.mm index e27c4d1ece..3192fc58e2 100644 --- a/dtool/src/dtoolutil/filename_assist.mm +++ b/dtool/src/dtoolutil/filename_assist.mm @@ -22,6 +22,8 @@ #include #endif +using std::string; + /** * Copy the Objective-C string to a C++ string. */ diff --git a/dtool/src/dtoolutil/filename_ext.cxx b/dtool/src/dtoolutil/filename_ext.cxx index 196492d23f..e60bf83a90 100644 --- a/dtool/src/dtoolutil/filename_ext.cxx +++ b/dtool/src/dtoolutil/filename_ext.cxx @@ -13,6 +13,9 @@ #include "filename_ext.h" +using std::string; +using std::wstring; + #ifdef HAVE_PYTHON #ifndef CPPPARSER diff --git a/dtool/src/dtoolutil/globPattern.cxx b/dtool/src/dtoolutil/globPattern.cxx index 57a6afdb57..982fe3bb1d 100644 --- a/dtool/src/dtoolutil/globPattern.cxx +++ b/dtool/src/dtoolutil/globPattern.cxx @@ -14,6 +14,8 @@ #include "globPattern.h" #include +using std::string; + /** * Returns true if the pattern includes any special globbing characters, or * false if it is just a literal string. diff --git a/dtool/src/dtoolutil/lineStreamBuf.cxx b/dtool/src/dtoolutil/lineStreamBuf.cxx index 4e9f990540..8ac3ed74f2 100644 --- a/dtool/src/dtoolutil/lineStreamBuf.cxx +++ b/dtool/src/dtoolutil/lineStreamBuf.cxx @@ -13,6 +13,8 @@ #include "lineStreamBuf.h" +using std::string; + /** * */ @@ -65,7 +67,7 @@ get_line() { */ int LineStreamBuf:: sync() { - streamsize n = pptr() - pbase(); + std::streamsize n = pptr() - pbase(); write_chars(pbase(), n); pbump(-(int)n); // Reset pptr(). return 0; // EOF to indicate write full. @@ -77,7 +79,7 @@ sync() { */ int LineStreamBuf:: overflow(int ch) { - streamsize n = pptr() - pbase(); + std::streamsize n = pptr() - pbase(); if (n != 0 && sync() != 0) { return EOF; diff --git a/dtool/src/dtoolutil/load_dso.cxx b/dtool/src/dtoolutil/load_dso.cxx index a54763afb1..79d821b5fa 100644 --- a/dtool/src/dtoolutil/load_dso.cxx +++ b/dtool/src/dtoolutil/load_dso.cxx @@ -14,6 +14,8 @@ #include "load_dso.h" #include "executionEnvironment.h" +using std::string; + static Filename resolve_dso(const DSearchPath &path, const Filename &filename) { if (filename.is_local()) { if ((path.get_num_directories()==1)&&(path.get_directory(0)=="")) { @@ -47,7 +49,7 @@ load_dso(const DSearchPath &path, const Filename &filename) { if (!abspath.is_regular_file()) { return nullptr; } - wstring os_specific_w = abspath.to_os_specific_w(); + std::wstring os_specific_w = abspath.to_os_specific_w(); // Try using LoadLibraryEx, if possible. typedef HMODULE (WINAPI *tLoadLibraryEx)(LPCWSTR, HANDLE, DWORD); @@ -104,7 +106,7 @@ load_dso_error() { } // Some unknown error code. - ostringstream errmsg; + std::ostringstream errmsg; errmsg << "Unknown error " << last_error; return errmsg.str(); } diff --git a/dtool/src/dtoolutil/pandaFileStreamBuf.cxx b/dtool/src/dtoolutil/pandaFileStreamBuf.cxx index 2e2c0ec035..676f17e0e6 100644 --- a/dtool/src/dtoolutil/pandaFileStreamBuf.cxx +++ b/dtool/src/dtoolutil/pandaFileStreamBuf.cxx @@ -25,6 +25,16 @@ #include #endif // _WIN32 +using std::cerr; +using std::dec; +using std::hex; +using std::ios; +using std::istream; +using std::ostream; +using std::streamoff; +using std::streampos; +using std::string; + PandaFileStreamBuf::NewlineMode PandaFileStreamBuf::_newline_mode = NM_native; static const size_t file_buffer_size = 4096; @@ -130,7 +140,7 @@ open(const char *filename, ios::openmode mode) { TextEncoder encoder; encoder.set_encoding(Filename::get_filesystem_encoding()); encoder.set_text(_filename); - wstring wfilename = encoder.get_wtext(); + std::wstring wfilename = encoder.get_wtext(); _handle = CreateFileW(wfilename.c_str(), access, share_mode, nullptr, creation_disposition, flags, nullptr); if (_handle != INVALID_HANDLE_VALUE) { diff --git a/dtool/src/dtoolutil/pandaSystem.cxx b/dtool/src/dtoolutil/pandaSystem.cxx index 5e7cc4b913..d09fecb663 100644 --- a/dtool/src/dtoolutil/pandaSystem.cxx +++ b/dtool/src/dtoolutil/pandaSystem.cxx @@ -15,6 +15,8 @@ #include "pandaVersion.h" #include "dtool_platform.h" +using std::string; + PandaSystem *PandaSystem::_global_ptr = nullptr; TypeHandle PandaSystem::_type_handle; @@ -220,7 +222,7 @@ string PandaSystem:: get_compiler() { #if defined(_MSC_VER) // MSVC defines this macro. It's an integer; we need to format it. - ostringstream strm; + std::ostringstream strm; strm << "MSC v." << _MSC_VER; // We also get this suite of macros that tells us what the build platform @@ -368,7 +370,7 @@ add_system(const string &system) { void PandaSystem:: set_system_tag(const string &system, const string &tag, const string &value) { - pair result; + std::pair result; result = _systems.insert(Systems::value_type(system, SystemTags(get_class_type()))); if (result.second) { _system_names_dirty = true; @@ -399,7 +401,7 @@ heap_trim(size_t pad) { * */ void PandaSystem:: -output(ostream &out) const { +output(std::ostream &out) const { out << "Panda version " << get_version_string(); } @@ -407,7 +409,7 @@ output(ostream &out) const { * */ void PandaSystem:: -write(ostream &out) const { +write(std::ostream &out) const { out << *this << "\n" << "compiled on " << get_build_date() << " by " << get_distributor() << "\n" diff --git a/dtool/src/dtoolutil/panda_getopt_impl.cxx b/dtool/src/dtoolutil/panda_getopt_impl.cxx index 9a216bbda0..030641a357 100644 --- a/dtool/src/dtoolutil/panda_getopt_impl.cxx +++ b/dtool/src/dtoolutil/panda_getopt_impl.cxx @@ -22,6 +22,7 @@ // If the system does lack one or the other of these functions, then we'll go // ahead and provide it instead. +using std::string; char *optarg = nullptr; int optind = 0; @@ -226,7 +227,7 @@ process(int opterr, int *longindex, char *&optarg, int &optind, int &optopt) { if (param._opt_index == 0 && opterr) { // This was an invalid character. optopt = param._short_option; - cerr << "Illegal option: -" << param._short_option << "\n"; + std::cerr << "Illegal option: -" << param._short_option << "\n"; return '?'; } diff --git a/dtool/src/dtoolutil/pfstreamBuf.cxx b/dtool/src/dtoolutil/pfstreamBuf.cxx index 591d2847e0..a5585ee3cd 100644 --- a/dtool/src/dtoolutil/pfstreamBuf.cxx +++ b/dtool/src/dtoolutil/pfstreamBuf.cxx @@ -14,6 +14,10 @@ #include "pfstreamBuf.h" #include +using std::cerr; +using std::endl; +using std::string; + PipeStreamBuf::PipeStreamBuf(PipeStreamBuf::Direction dir) : _dir(dir) { @@ -56,7 +60,7 @@ void PipeStreamBuf::command(const string cmd) { int PipeStreamBuf::overflow(int c) { assert(is_open()); assert(_dir == Output); - streamsize n = pptr() - pbase(); + std::streamsize n = pptr() - pbase(); if (n != 0) { write_chars(pbase(), n, false); pbump(-n); // reset pptr() @@ -72,11 +76,11 @@ int PipeStreamBuf::overflow(int c) { int PipeStreamBuf::sync(void) { assert(is_open()); if (_dir == Output) { - streamsize n = pptr() - pbase(); + std::streamsize n = pptr() - pbase(); write_chars(pbase(), n, false); pbump(-n); } else { - streamsize n = egptr() - gptr(); + std::streamsize n = egptr() - gptr(); if (n != 0) { gbump(n); // flush all our stored input away #ifndef NDEBUG diff --git a/dtool/src/dtoolutil/stringDecoder.cxx b/dtool/src/dtoolutil/stringDecoder.cxx index 847d8559bd..e77e0c5e13 100644 --- a/dtool/src/dtoolutil/stringDecoder.cxx +++ b/dtool/src/dtoolutil/stringDecoder.cxx @@ -14,7 +14,7 @@ #include "stringDecoder.h" #include "config_dtoolutil.h" -ostream *StringDecoder::_notify_ptr = &cerr; +std::ostream *StringDecoder::_notify_ptr = &std::cerr; /** * @@ -41,7 +41,7 @@ get_next_character() { * notify. */ void StringDecoder:: -set_notify_ptr(ostream *notify_ptr) { +set_notify_ptr(std::ostream *notify_ptr) { _notify_ptr = notify_ptr; } @@ -49,7 +49,7 @@ set_notify_ptr(ostream *notify_ptr) { * Returns the ostream that is used to write error messages to. See * set_notify_ptr(). */ -ostream *StringDecoder:: +std::ostream *StringDecoder:: get_notify_ptr() { return _notify_ptr; } @@ -131,7 +131,7 @@ get_next_character() { // utf-8 bytes--we have an error. if (_notify_ptr != nullptr) { (*_notify_ptr) - << "Non utf-8 byte in string: 0x" << hex << result << dec + << "Non utf-8 byte in string: 0x" << std::hex << result << std::dec << ", string is '" << _input << "'\n"; } return -1; diff --git a/dtool/src/dtoolutil/string_utils.cxx b/dtool/src/dtoolutil/string_utils.cxx index 600b07e7ed..50d5d53802 100644 --- a/dtool/src/dtoolutil/string_utils.cxx +++ b/dtool/src/dtoolutil/string_utils.cxx @@ -17,6 +17,9 @@ #include +using std::string; +using std::wstring; + // Case-insensitive string comparison, from Stroustrup's C++ third edition. // Works like strcmp(). int diff --git a/dtool/src/dtoolutil/test_pfstream.cxx b/dtool/src/dtoolutil/test_pfstream.cxx index b088079723..93bebd6236 100644 --- a/dtool/src/dtoolutil/test_pfstream.cxx +++ b/dtool/src/dtoolutil/test_pfstream.cxx @@ -17,26 +17,26 @@ int main(int argc, char *argv[]) { if (argc < 2) { - cout << "test_pfstream command-line\n"; + std::cout << "test_pfstream command-line\n"; return (1); } // Build one command out of the arguments. - string cmd; + std::string cmd; cmd = argv[1]; for (int i = 2; i < argc; i++) { cmd += " "; cmd += argv[i]; } - cout << "Executing command:\n" << cmd << "\n"; + std::cout << "Executing command:\n" << cmd << "\n"; IPipeStream in(cmd); char c; c = in.get(); while (in && !in.fail() && !in.eof()) { - cout.put(toupper(c)); + std::cout.put(toupper(c)); c = in.get(); } diff --git a/dtool/src/dtoolutil/test_touch.cxx b/dtool/src/dtoolutil/test_touch.cxx index 722a94a85e..94a7d2782c 100644 --- a/dtool/src/dtoolutil/test_touch.cxx +++ b/dtool/src/dtoolutil/test_touch.cxx @@ -17,7 +17,7 @@ int main(int argc, char *argv[]) { if (argc < 2) { - cout << "test_touch filename [filename ... ]\n"; + std::cout << "test_touch filename [filename ... ]\n"; return (1); } diff --git a/dtool/src/dtoolutil/textEncoder.cxx b/dtool/src/dtoolutil/textEncoder.cxx index 90ce30d395..1e1cd4bc61 100644 --- a/dtool/src/dtoolutil/textEncoder.cxx +++ b/dtool/src/dtoolutil/textEncoder.cxx @@ -16,6 +16,11 @@ #include "unicodeLatinMap.h" #include "config_dtoolutil.h" +using std::istream; +using std::ostream; +using std::string; +using std::wstring; + TextEncoder::Encoding TextEncoder::_default_encoding = TextEncoder::E_iso8859; /** diff --git a/dtool/src/dtoolutil/win32ArgParser.cxx b/dtool/src/dtoolutil/win32ArgParser.cxx index 231b4af12b..4faf6bff95 100644 --- a/dtool/src/dtoolutil/win32ArgParser.cxx +++ b/dtool/src/dtoolutil/win32ArgParser.cxx @@ -24,6 +24,8 @@ #include #include +using std::string; + /** * */ @@ -97,7 +99,7 @@ set_command_line(const string &command_line) { * starts parsing this into argc, argv. */ void Win32ArgParser:: -set_command_line(const wstring &command_line) { +set_command_line(const std::wstring &command_line) { TextEncoder encoder; encoder.set_encoding(Filename::get_filesystem_encoding()); encoder.set_wtext(command_line); @@ -146,7 +148,7 @@ do_glob() { // means to do it. string envvar = ExecutionEnvironment::get_environment_variable("PANDA_GLOB"); if (!envvar.empty()) { - istringstream strm(envvar); + std::istringstream strm(envvar); int value; strm >> value; if (!strm.fail()) { diff --git a/dtool/src/interrogate/functionRemap.cxx b/dtool/src/interrogate/functionRemap.cxx index 745d084b72..e7a2f828d9 100644 --- a/dtool/src/interrogate/functionRemap.cxx +++ b/dtool/src/interrogate/functionRemap.cxx @@ -32,6 +32,10 @@ #include "interrogateType.h" #include "pnotify.h" +using std::ostream; +using std::ostringstream; +using std::string; + /** * */ @@ -439,7 +443,10 @@ get_call_str(const string &container, const vector_string &pexprs) const { call << ")." << _cppfunc->get_local_name(); } else { - call << _cppfunc->get_local_name(&parser); + if (_cpptype != nullptr) { + call << _cpptype->get_local_name(&parser); + } + call << "::" << _cppfunc->get_local_name(); } } call << "("; diff --git a/dtool/src/interrogate/functionWriter.cxx b/dtool/src/interrogate/functionWriter.cxx index 6a5c3e4e34..58937d3f3d 100644 --- a/dtool/src/interrogate/functionWriter.cxx +++ b/dtool/src/interrogate/functionWriter.cxx @@ -30,7 +30,7 @@ FunctionWriter:: /** * */ -const string &FunctionWriter:: +const std::string &FunctionWriter:: get_name() const { return _name; } @@ -42,7 +42,7 @@ int FunctionWriter:: compare_to(const FunctionWriter &other) const { // Lexicographical string comparison. - string::const_iterator n1, n2; + std::string::const_iterator n1, n2; n1 = _name.begin(); n2 = other._name.begin(); while (n1 != _name.end() && n2 != other._name.end()) { @@ -65,12 +65,12 @@ compare_to(const FunctionWriter &other) const { * Outputs the prototype for the function. */ void FunctionWriter:: -write_prototype(ostream &) { +write_prototype(std::ostream &) { } /** * Outputs the code for the function. */ void FunctionWriter:: -write_code(ostream &) { +write_code(std::ostream &) { } diff --git a/dtool/src/interrogate/functionWriterPtrFromPython.cxx b/dtool/src/interrogate/functionWriterPtrFromPython.cxx index c27ef1efe5..016d79cff7 100644 --- a/dtool/src/interrogate/functionWriterPtrFromPython.cxx +++ b/dtool/src/interrogate/functionWriterPtrFromPython.cxx @@ -43,7 +43,7 @@ FunctionWriterPtrFromPython:: * Outputs the prototype for the function. */ void FunctionWriterPtrFromPython:: -write_prototype(ostream &out) { +write_prototype(std::ostream &out) { CPPType *ppointer = new CPPPointerType(_pointer_type); out << "static int " << _name << "(PyObject *obj, "; @@ -57,7 +57,7 @@ write_prototype(ostream &out) { * Outputs the code for the function. */ void FunctionWriterPtrFromPython:: -write_code(ostream &out) { +write_code(std::ostream &out) { CPPType *ppointer = new CPPPointerType(_pointer_type); out << "static int\n" diff --git a/dtool/src/interrogate/functionWriterPtrToPython.cxx b/dtool/src/interrogate/functionWriterPtrToPython.cxx index aac2984dbc..e2486dae7c 100644 --- a/dtool/src/interrogate/functionWriterPtrToPython.cxx +++ b/dtool/src/interrogate/functionWriterPtrToPython.cxx @@ -44,7 +44,7 @@ FunctionWriterPtrToPython:: * Outputs the prototype for the function. */ void FunctionWriterPtrToPython:: -write_prototype(ostream &out) { +write_prototype(std::ostream &out) { out << "static PyObject *" << _name << "("; _pointer_type->output_instance(out, "addr", &parser); out << ", int caller_manages);\n"; @@ -54,8 +54,8 @@ write_prototype(ostream &out) { * Outputs the code for the function. */ void FunctionWriterPtrToPython:: -write_code(ostream &out) { - string classobj_func = InterfaceMakerPythonObj::get_builder_name(_type); +write_code(std::ostream &out) { + std::string classobj_func = InterfaceMakerPythonObj::get_builder_name(_type); out << "static PyObject *\n" << _name << "("; _pointer_type->output_instance(out, "addr", &parser); diff --git a/dtool/src/interrogate/functionWriters.cxx b/dtool/src/interrogate/functionWriters.cxx index 93ee5945fc..2d1d167b2d 100644 --- a/dtool/src/interrogate/functionWriters.cxx +++ b/dtool/src/interrogate/functionWriters.cxx @@ -41,7 +41,7 @@ FunctionWriters:: */ FunctionWriter *FunctionWriters:: add_writer(FunctionWriter *writer) { - pair result = _writers.insert(writer); + std::pair result = _writers.insert(writer); if (!result.second) { // Already there; delete the pointer. delete writer; @@ -55,7 +55,7 @@ add_writer(FunctionWriter *writer) { * Generates prototypes for all of the functions. */ void FunctionWriters:: -write_prototypes(ostream &out) { +write_prototypes(std::ostream &out) { Writers::iterator wi; for (wi = _writers.begin(); wi != _writers.end(); ++wi) { FunctionWriter *writer = (*wi); @@ -67,7 +67,7 @@ write_prototypes(ostream &out) { * Generates all of the functions. */ void FunctionWriters:: -write_code(ostream &out) { +write_code(std::ostream &out) { Writers::iterator wi; for (wi = _writers.begin(); wi != _writers.end(); ++wi) { FunctionWriter *writer = (*wi); diff --git a/dtool/src/interrogate/interfaceMaker.cxx b/dtool/src/interrogate/interfaceMaker.cxx index 69ab181286..0d4d56dfc1 100644 --- a/dtool/src/interrogate/interfaceMaker.cxx +++ b/dtool/src/interrogate/interfaceMaker.cxx @@ -39,6 +39,10 @@ #include "cppStructType.h" #include "pnotify.h" +using std::ostream; +using std::ostringstream; +using std::string; + InterrogateType dummy_type; /** diff --git a/dtool/src/interrogate/interfaceMakerC.cxx b/dtool/src/interrogate/interfaceMakerC.cxx index 966e9c058d..64b36fc366 100644 --- a/dtool/src/interrogate/interfaceMakerC.cxx +++ b/dtool/src/interrogate/interfaceMakerC.cxx @@ -24,6 +24,8 @@ #include "interrogateFunction.h" #include "cppFunctionType.h" +using std::ostream; + /** * */ @@ -115,7 +117,7 @@ synthesize_this_parameter() { /** * Returns the prefix string used to generate wrapper function names. */ -string InterfaceMakerC:: +std::string InterfaceMakerC:: get_wrapper_prefix() { return "_inC"; } @@ -124,7 +126,7 @@ get_wrapper_prefix() { * Returns the prefix string used to generate unique symbolic names, which are * not necessarily C-callable function names. */ -string InterfaceMakerC:: +std::string InterfaceMakerC:: get_unique_prefix() { return "c"; } @@ -206,7 +208,7 @@ write_function_instance(ostream &out, InterfaceMaker::Function *func, write_spam_message(out, remap); } - string return_expr = + std::string return_expr = remap->call_function(out, 2, true, "param0"); return_expr = manage_return_value(out, 2, remap, return_expr); if (!return_expr.empty()) { diff --git a/dtool/src/interrogate/interfaceMakerPython.cxx b/dtool/src/interrogate/interfaceMakerPython.cxx index 31f59c0785..cfd82edf19 100644 --- a/dtool/src/interrogate/interfaceMakerPython.cxx +++ b/dtool/src/interrogate/interfaceMakerPython.cxx @@ -28,7 +28,7 @@ InterfaceMakerPython(InterrogateModuleDef *def) : * particular interface to the indicated output stream. */ void InterfaceMakerPython:: -write_includes(ostream &out) { +write_includes(std::ostream &out) { InterfaceMaker::write_includes(out); out << "#undef _POSIX_C_SOURCE\n" << "#undef _XOPEN_SOURCE\n" @@ -45,7 +45,7 @@ write_includes(ostream &out) { * was executing, and report this failure back to Python. */ void InterfaceMakerPython:: -test_assert(ostream &out, int indent_level) const { +test_assert(std::ostream &out, int indent_level) const { if (watch_asserts) { out << "#ifndef NDEBUG\n"; indent(out, indent_level) diff --git a/dtool/src/interrogate/interfaceMakerPythonNative.cxx b/dtool/src/interrogate/interfaceMakerPythonNative.cxx index c040f0dc6c..6a47257eda 100644 --- a/dtool/src/interrogate/interfaceMakerPythonNative.cxx +++ b/dtool/src/interrogate/interfaceMakerPythonNative.cxx @@ -39,7 +39,17 @@ #include #include -extern InterrogateType dummy_type; +using std::dec; +using std::hex; +using std::max; +using std::min; +using std::oct; +using std::ostream; +using std::ostringstream; +using std::set; +using std::string; + +extern InterrogateType dummy_type; extern std::string EXPORT_IMPORT_PREFIX; #define CLASS_PREFIX "Dtool_" @@ -702,7 +712,7 @@ get_valid_child_classes(std::map &answer, CPPStructTyp void InterfaceMakerPythonNative:: write_python_instance(ostream &out, int indent_level, const string &return_expr, bool owns_memory, const InterrogateType &itype, bool is_const) { - out << boolalpha; + out << std::boolalpha; if (!isExportThisRun(itype._cpptype)) { _external_imports.insert(TypeManager::resolve_type(itype._cpptype)); @@ -1049,10 +1059,10 @@ write_class_details(ostream &out, Object *obj) { write_make_seq(out, obj, ClassName, cClassName, *msi); } else { if (!is_function_legal((*msi)->_length_getter)) { - cerr << "illegal length function for MAKE_SEQ: " << (*msi)->_length_getter->_name << "\n"; + std::cerr << "illegal length function for MAKE_SEQ: " << (*msi)->_length_getter->_name << "\n"; } if (!is_function_legal((*msi)->_element_getter)) { - cerr << "illegal element function for MAKE_SEQ: " << (*msi)->_element_getter->_name << "\n"; + std::cerr << "illegal element function for MAKE_SEQ: " << (*msi)->_element_getter->_name << "\n"; } } } @@ -2447,7 +2457,7 @@ write_module_class(ostream &out, Object *obj) { // Nothing special about the wrapper function: just write it normally. string fname = "static PyObject *" + def._wrapper_name + "(PyObject *self, PyObject *args, PyObject *kwds)\n"; - vector remaps; + std::vector remaps; remaps.insert(remaps.end(), def._remaps.begin(), def._remaps.end()); string expected_params; write_function_for_name(out, obj, remaps, fname, expected_params, true, AT_keyword_args, RF_pyobject | RF_err_null); @@ -2473,7 +2483,7 @@ write_module_class(ostream &out, Object *obj) { out << " if (!Dtool_Call_ExtractThisPointer(self, Dtool_" << ClassName << ", (void **)&local_this)) {\n"; out << " return nullptr;\n"; out << " }\n\n"; - out << " ostringstream os;\n"; + out << " std::ostringstream os;\n"; if (need_repr == 3) { out << " invoke_extension(local_this).python_repr(os, \"" << classNameFromCppName(ClassName, false) << "\");\n"; @@ -2503,7 +2513,7 @@ write_module_class(ostream &out, Object *obj) { out << " if (!Dtool_Call_ExtractThisPointer(self, Dtool_" << ClassName << ", (void **)&local_this)) {\n"; out << " return nullptr;\n"; out << " }\n\n"; - out << " ostringstream os;\n"; + out << " std::ostringstream os;\n"; if (need_str == 2) { out << " local_this->write(os, 0);\n"; } else { @@ -3050,7 +3060,7 @@ write_module_class(ostream &out, Object *obj) { out << " // Dependent objects\n"; if (bases.size() > 0) { string baseargs; - for (vector::iterator bi = bases.begin(); bi != bases.end(); ++bi) { + for (std::vector::iterator bi = bases.begin(); bi != bases.end(); ++bi) { string safe_name = make_safe_name((*bi)->get_local_name(&parser)); if (isExportThisRun(*bi)) { @@ -5571,7 +5581,7 @@ write_function_instance(ostream &out, FunctionRemap *remap, << ", *Dtool_Ptr_" << make_safe_name(class_name) << ");\n"; } else { - extra_convert << boolalpha + extra_convert << std::boolalpha << " = (" << class_name << " *)" << "DTOOL_Call_GetPointerThisClass(" << param_name << ", Dtool_Ptr_" << make_safe_name(class_name) @@ -7873,7 +7883,7 @@ output_quoted(ostream &out, int indent_level, const std::string &str, default: if (!isprint(*si)) { - out << "\\" << oct << setw(3) << setfill('0') << (unsigned int)(*si) + out << "\\" << oct << std::setw(3) << std::setfill('0') << (unsigned int)(*si) << dec; } else { out << *si; diff --git a/dtool/src/interrogate/interfaceMakerPythonObj.cxx b/dtool/src/interrogate/interfaceMakerPythonObj.cxx index 3f11acb855..fa0e35eaea 100644 --- a/dtool/src/interrogate/interfaceMakerPythonObj.cxx +++ b/dtool/src/interrogate/interfaceMakerPythonObj.cxx @@ -25,6 +25,9 @@ #include "interrogateFunction.h" #include "cppFunctionType.h" +using std::ostream; +using std::string; + /** * */ diff --git a/dtool/src/interrogate/interfaceMakerPythonSimple.cxx b/dtool/src/interrogate/interfaceMakerPythonSimple.cxx index 8ee9552250..c0f1be390a 100644 --- a/dtool/src/interrogate/interfaceMakerPythonSimple.cxx +++ b/dtool/src/interrogate/interfaceMakerPythonSimple.cxx @@ -23,6 +23,9 @@ #include "interrogateFunction.h" #include "cppFunctionType.h" +using std::ostream; +using std::string; + /** * */ diff --git a/dtool/src/interrogate/interrogate.cxx b/dtool/src/interrogate/interrogate.cxx index 39b69e2c1d..d11bd22ff6 100644 --- a/dtool/src/interrogate/interrogate.cxx +++ b/dtool/src/interrogate/interrogate.cxx @@ -22,6 +22,9 @@ #include "pystub.h" #include +using std::cerr; +using std::string; + CPPParser parser; Filename output_code_filename; diff --git a/dtool/src/interrogate/interrogateBuilder.cxx b/dtool/src/interrogate/interrogateBuilder.cxx index f320a66943..f579f1586d 100644 --- a/dtool/src/interrogate/interrogateBuilder.cxx +++ b/dtool/src/interrogate/interrogateBuilder.cxx @@ -50,6 +50,13 @@ #include #include +using std::cerr; +using std::istream; +using std::map; +using std::ostream; +using std::ostringstream; +using std::string; + InterrogateBuilder builder; std::string EXPORT_IMPORT_PREFIX; @@ -1699,7 +1706,7 @@ get_function(CPPInstance *function, string description, ifunction._flags |= flags; // Also, make sure this particular signature is defined. - pair result = + std::pair result = ifunction._instances->insert(InterrogateFunction::Instances::value_type(function_signature, function)); InterrogateFunction::Instances::iterator ii = result.first; diff --git a/dtool/src/interrogate/interrogate_module.cxx b/dtool/src/interrogate/interrogate_module.cxx index 0fe4534890..5c5cc9d9ab 100644 --- a/dtool/src/interrogate/interrogate_module.cxx +++ b/dtool/src/interrogate/interrogate_module.cxx @@ -27,6 +27,9 @@ #include +using std::cerr; +using std::string; + Filename output_code_filename; string module_name; string library_name; @@ -149,7 +152,7 @@ static bool print_dependent_types(const string &lib1, const string &lib2) { return false; } -int write_python_table_native(ostream &out) { +int write_python_table_native(std::ostream &out) { out << "\n#include \"dtoolbase.h\"\n" << "#include \"interrogate_request.h\"\n\n" << "#include \"py_panda.h\"\n\n"; @@ -192,7 +195,7 @@ int write_python_table_native(ostream &out) { interrogate_type_has_library_name(basetype)) { string baselib = interrogate_type_library_name(basetype); if (baselib != library_name) { - deps.insert(move(baselib)); + deps.insert(std::move(baselib)); } } } @@ -203,7 +206,7 @@ int write_python_table_native(ostream &out) { interrogate_type_has_library_name(wrapped)) { string wrappedlib = interrogate_type_library_name(wrapped); if (wrappedlib != library_name) { - deps.insert(move(wrappedlib)); + deps.insert(std::move(wrappedlib)); } } } @@ -420,7 +423,7 @@ int write_python_table_native(ostream &out) { return count; } -int write_python_table(ostream &out) { +int write_python_table(std::ostream &out) { out << "\n#include \"dtoolbase.h\"\n" << "#include \"interrogate_request.h\"\n\n" << "#undef _POSIX_C_SOURCE\n" diff --git a/dtool/src/interrogate/parameterRemap.cxx b/dtool/src/interrogate/parameterRemap.cxx index 19c6bb4251..4794c7c16d 100644 --- a/dtool/src/interrogate/parameterRemap.cxx +++ b/dtool/src/interrogate/parameterRemap.cxx @@ -13,6 +13,8 @@ #include "parameterRemap.h" +using std::string; + /** * @@ -26,7 +28,7 @@ ParameterRemap:: * original type to the new type, for passing into the actual C++ function. */ void ParameterRemap:: -pass_parameter(ostream &out, const string &variable_name) { +pass_parameter(std::ostream &out, const string &variable_name) { out << variable_name; } @@ -37,7 +39,7 @@ pass_parameter(ostream &out, const string &variable_name) { * return the modified expression. */ string ParameterRemap:: -prepare_return_expr(ostream &, int, const string &expression) { +prepare_return_expr(std::ostream &, int, const string &expression) { return expression; } diff --git a/dtool/src/interrogate/parameterRemapBasicStringPtrToString.cxx b/dtool/src/interrogate/parameterRemapBasicStringPtrToString.cxx index d2ea916fff..07dad4694a 100644 --- a/dtool/src/interrogate/parameterRemapBasicStringPtrToString.cxx +++ b/dtool/src/interrogate/parameterRemapBasicStringPtrToString.cxx @@ -14,6 +14,8 @@ #include "parameterRemapBasicStringPtrToString.h" #include "interrogate.h" +using std::string; + /** * */ @@ -34,7 +36,7 @@ ParameterRemapBasicStringPtrToString(CPPType *orig_type) : * original type to the new type, for passing into the actual C++ function. */ void ParameterRemapBasicStringPtrToString:: -pass_parameter(ostream &out, const string &variable_name) { +pass_parameter(std::ostream &out, const string &variable_name) { out << "&std::string(" << variable_name << ")"; } @@ -67,7 +69,7 @@ ParameterRemapBasicWStringPtrToWString(CPPType *orig_type) : * original type to the new type, for passing into the actual C++ function. */ void ParameterRemapBasicWStringPtrToWString:: -pass_parameter(ostream &out, const string &variable_name) { +pass_parameter(std::ostream &out, const string &variable_name) { out << "&std::wstring(" << variable_name << ")"; } diff --git a/dtool/src/interrogate/parameterRemapBasicStringRefToString.cxx b/dtool/src/interrogate/parameterRemapBasicStringRefToString.cxx index 0e5bac31ff..90cd3d7e45 100644 --- a/dtool/src/interrogate/parameterRemapBasicStringRefToString.cxx +++ b/dtool/src/interrogate/parameterRemapBasicStringRefToString.cxx @@ -14,6 +14,8 @@ #include "parameterRemapBasicStringRefToString.h" #include "interrogate.h" +using std::string; + /** * */ @@ -34,7 +36,7 @@ ParameterRemapBasicStringRefToString(CPPType *orig_type) : * original type to the new type, for passing into the actual C++ function. */ void ParameterRemapBasicStringRefToString:: -pass_parameter(ostream &out, const string &variable_name) { +pass_parameter(std::ostream &out, const string &variable_name) { out << "std::string(" << variable_name << ")"; } @@ -67,7 +69,7 @@ ParameterRemapBasicWStringRefToWString(CPPType *orig_type) : * original type to the new type, for passing into the actual C++ function. */ void ParameterRemapBasicWStringRefToWString:: -pass_parameter(ostream &out, const string &variable_name) { +pass_parameter(std::ostream &out, const string &variable_name) { out << "std::wstring(" << variable_name << ")"; } diff --git a/dtool/src/interrogate/parameterRemapBasicStringToString.cxx b/dtool/src/interrogate/parameterRemapBasicStringToString.cxx index d2ed1f0406..21faabfaac 100644 --- a/dtool/src/interrogate/parameterRemapBasicStringToString.cxx +++ b/dtool/src/interrogate/parameterRemapBasicStringToString.cxx @@ -15,6 +15,9 @@ #include "interfaceMaker.h" #include "interrogate.h" +using std::ostream; +using std::string; + /** * */ diff --git a/dtool/src/interrogate/parameterRemapConcreteToPointer.cxx b/dtool/src/interrogate/parameterRemapConcreteToPointer.cxx index 05f0eda533..f5e7c35b39 100644 --- a/dtool/src/interrogate/parameterRemapConcreteToPointer.cxx +++ b/dtool/src/interrogate/parameterRemapConcreteToPointer.cxx @@ -36,7 +36,7 @@ ParameterRemapConcreteToPointer(CPPType *orig_type) : * type to the original type, for passing into the actual C++ function. */ void ParameterRemapConcreteToPointer:: -pass_parameter(ostream &out, const string &variable_name) { +pass_parameter(std::ostream &out, const std::string &variable_name) { if (variable_name.size() > 1 && variable_name[0] == '&') { // Prevent generating something like *¶m Also, if this is really some // local type, we can presumably just move it? @@ -50,8 +50,8 @@ pass_parameter(ostream &out, const string &variable_name) { * Returns an expression that evalutes to the appropriate value type for * returning from the function, given an expression of the original type. */ -string ParameterRemapConcreteToPointer:: -get_return_expr(const string &expression) { +std::string ParameterRemapConcreteToPointer:: +get_return_expr(const std::string &expression) { return "new " + _orig_type->get_local_name(&parser) + "(" + expression + ")"; diff --git a/dtool/src/interrogate/parameterRemapConstToNonConst.cxx b/dtool/src/interrogate/parameterRemapConstToNonConst.cxx index c031350e70..2fb23e90bc 100644 --- a/dtool/src/interrogate/parameterRemapConstToNonConst.cxx +++ b/dtool/src/interrogate/parameterRemapConstToNonConst.cxx @@ -31,7 +31,7 @@ ParameterRemapConstToNonConst(CPPType *orig_type) : * type to the original type, for passing into the actual C++ function. */ void ParameterRemapConstToNonConst:: -pass_parameter(ostream &out, const string &variable_name) { +pass_parameter(std::ostream &out, const std::string &variable_name) { out << variable_name; } @@ -39,7 +39,7 @@ pass_parameter(ostream &out, const string &variable_name) { * Returns an expression that evalutes to the appropriate value type for * returning from the function, given an expression of the original type. */ -string ParameterRemapConstToNonConst:: -get_return_expr(const string &expression) { +std::string ParameterRemapConstToNonConst:: +get_return_expr(const std::string &expression) { return expression; } diff --git a/dtool/src/interrogate/parameterRemapEnumToInt.cxx b/dtool/src/interrogate/parameterRemapEnumToInt.cxx index 40283dd364..59fb6019fc 100644 --- a/dtool/src/interrogate/parameterRemapEnumToInt.cxx +++ b/dtool/src/interrogate/parameterRemapEnumToInt.cxx @@ -35,7 +35,7 @@ ParameterRemapEnumToInt(CPPType *orig_type) : * type to the original type, for passing into the actual C++ function. */ void ParameterRemapEnumToInt:: -pass_parameter(ostream &out, const string &variable_name) { +pass_parameter(std::ostream &out, const std::string &variable_name) { out << "(" << _enum_type->get_local_name(&parser) << ")" << variable_name; } @@ -43,8 +43,8 @@ pass_parameter(ostream &out, const string &variable_name) { * Returns an expression that evalutes to the appropriate value type for * returning from the function, given an expression of the original type. */ -string ParameterRemapEnumToInt:: -get_return_expr(const string &expression) { +std::string ParameterRemapEnumToInt:: +get_return_expr(const std::string &expression) { return "(int)(" + expression + ")"; } diff --git a/dtool/src/interrogate/parameterRemapHandleToInt.cxx b/dtool/src/interrogate/parameterRemapHandleToInt.cxx index b22052c7c3..4594ca45c8 100644 --- a/dtool/src/interrogate/parameterRemapHandleToInt.cxx +++ b/dtool/src/interrogate/parameterRemapHandleToInt.cxx @@ -36,7 +36,7 @@ ParameterRemapHandleToInt(CPPType *orig_type) : * type to the original type, for passing into the actual C++ function. */ void ParameterRemapHandleToInt:: -pass_parameter(ostream &out, const string &variable_name) { +pass_parameter(std::ostream &out, const std::string &variable_name) { CPPType *unwrapped = TypeManager::unwrap_const(_orig_type); if (unwrapped->get_local_name(&parser) == "TypeHandle") { @@ -50,7 +50,7 @@ pass_parameter(ostream &out, const string &variable_name) { * Returns an expression that evalutes to the appropriate value type for * returning from the function, given an expression of the original type. */ -string ParameterRemapHandleToInt:: -get_return_expr(const string &expression) { +std::string ParameterRemapHandleToInt:: +get_return_expr(const std::string &expression) { return "(" + expression + ").get_index()"; } diff --git a/dtool/src/interrogate/parameterRemapPTToPointer.cxx b/dtool/src/interrogate/parameterRemapPTToPointer.cxx index d4aefb71d2..243b907260 100644 --- a/dtool/src/interrogate/parameterRemapPTToPointer.cxx +++ b/dtool/src/interrogate/parameterRemapPTToPointer.cxx @@ -21,6 +21,8 @@ #include "cppDeclaration.h" #include "pnotify.h" +using std::string; + /** * */ @@ -64,7 +66,7 @@ ParameterRemapPTToPointer(CPPType *orig_type) : * type to the original type, for passing into the actual C++ function. */ void ParameterRemapPTToPointer:: -pass_parameter(ostream &out, const string &variable_name) { +pass_parameter(std::ostream &out, const string &variable_name) { out << variable_name; } diff --git a/dtool/src/interrogate/parameterRemapReferenceToConcrete.cxx b/dtool/src/interrogate/parameterRemapReferenceToConcrete.cxx index c4a4e77451..bdb613cef6 100644 --- a/dtool/src/interrogate/parameterRemapReferenceToConcrete.cxx +++ b/dtool/src/interrogate/parameterRemapReferenceToConcrete.cxx @@ -35,7 +35,7 @@ ParameterRemapReferenceToConcrete(CPPType *orig_type) : * type to the original type, for passing into the actual C++ function. */ void ParameterRemapReferenceToConcrete:: -pass_parameter(ostream &out, const string &variable_name) { +pass_parameter(std::ostream &out, const std::string &variable_name) { out << variable_name; } @@ -43,7 +43,7 @@ pass_parameter(ostream &out, const string &variable_name) { * Returns an expression that evalutes to the appropriate value type for * returning from the function, given an expression of the original type. */ -string ParameterRemapReferenceToConcrete:: -get_return_expr(const string &expression) { +std::string ParameterRemapReferenceToConcrete:: +get_return_expr(const std::string &expression) { return expression; } diff --git a/dtool/src/interrogate/parameterRemapReferenceToPointer.cxx b/dtool/src/interrogate/parameterRemapReferenceToPointer.cxx index 3199017eea..6c8e8b05a9 100644 --- a/dtool/src/interrogate/parameterRemapReferenceToPointer.cxx +++ b/dtool/src/interrogate/parameterRemapReferenceToPointer.cxx @@ -35,7 +35,7 @@ ParameterRemapReferenceToPointer(CPPType *orig_type) : * type to the original type, for passing into the actual C++ function. */ void ParameterRemapReferenceToPointer:: -pass_parameter(ostream &out, const string &variable_name) { +pass_parameter(std::ostream &out, const std::string &variable_name) { if (variable_name.size() > 1 && variable_name[0] == '&') { // Prevent generating something like *¶m Also, if this is really some // local type, we can presumably just move it? This is only relevant if @@ -52,7 +52,7 @@ pass_parameter(ostream &out, const string &variable_name) { * Returns an expression that evalutes to the appropriate value type for * returning from the function, given an expression of the original type. */ -string ParameterRemapReferenceToPointer:: -get_return_expr(const string &expression) { +std::string ParameterRemapReferenceToPointer:: +get_return_expr(const std::string &expression) { return "&(" + expression + ")"; } diff --git a/dtool/src/interrogate/parameterRemapThis.cxx b/dtool/src/interrogate/parameterRemapThis.cxx index e0ef867931..7fd8be4243 100644 --- a/dtool/src/interrogate/parameterRemapThis.cxx +++ b/dtool/src/interrogate/parameterRemapThis.cxx @@ -39,7 +39,7 @@ ParameterRemapThis(CPPType *type, bool is_const) : * type to the original type, for passing into the actual C++ function. */ void ParameterRemapThis:: -pass_parameter(ostream &out, const string &variable_name) { +pass_parameter(std::ostream &out, const std::string &variable_name) { out << "(*" << variable_name << ")"; } @@ -47,8 +47,8 @@ pass_parameter(ostream &out, const string &variable_name) { * Returns an expression that evalutes to the appropriate value type for * returning from the function, given an expression of the original type. */ -string ParameterRemapThis:: -get_return_expr(const string &) { +std::string ParameterRemapThis:: +get_return_expr(const std::string &) { return "**invalid**"; } diff --git a/dtool/src/interrogate/parameterRemapToString.cxx b/dtool/src/interrogate/parameterRemapToString.cxx index 0a3abe4559..9771a2db1b 100644 --- a/dtool/src/interrogate/parameterRemapToString.cxx +++ b/dtool/src/interrogate/parameterRemapToString.cxx @@ -15,6 +15,8 @@ #include "interrogate.h" #include "typeManager.h" +using std::string; + /** * */ @@ -44,7 +46,7 @@ ParameterRemapToString(CPPType *orig_type) : * original type to the new type, for passing into the actual C++ function. */ void ParameterRemapToString:: -pass_parameter(ostream &out, const string &variable_name) { +pass_parameter(std::ostream &out, const string &variable_name) { out << variable_name; } @@ -88,7 +90,7 @@ ParameterRemapToWString(CPPType *orig_type) : * original type to the new type, for passing into the actual C++ function. */ void ParameterRemapToWString:: -pass_parameter(ostream &out, const string &variable_name) { +pass_parameter(std::ostream &out, const string &variable_name) { out << variable_name; } diff --git a/dtool/src/interrogate/parse_file.cxx b/dtool/src/interrogate/parse_file.cxx index 9eb45fcc5b..aa903407d1 100644 --- a/dtool/src/interrogate/parse_file.cxx +++ b/dtool/src/interrogate/parse_file.cxx @@ -25,6 +25,11 @@ #include "pystub.h" #include +using std::cerr; +using std::cin; +using std::cout; +using std::string; + CPPParser parser; void diff --git a/dtool/src/interrogate/typeManager.cxx b/dtool/src/interrogate/typeManager.cxx index 85161eb69e..b7b744aa86 100644 --- a/dtool/src/interrogate/typeManager.cxx +++ b/dtool/src/interrogate/typeManager.cxx @@ -30,6 +30,8 @@ #include "cppTypedefType.h" #include "pnotify.h" +using std::string; + /** * A horrible hack around a CPPParser bug. We don't trust the CPPType pointer * we were given; instead, we ask CPPParser to parse a new type of the same @@ -2251,7 +2253,7 @@ get_function_signature(CPPInstance *function, CPPFunctionType *ftype = function->_type->as_function_type(); assert(ftype != nullptr); - ostringstream out; + std::ostringstream out; // It's tempting to mark static methods with a different function signature // than non-static, because a static method doesn't have an implicit 'this' diff --git a/dtool/src/interrogatedb/interrogateComponent.cxx b/dtool/src/interrogatedb/interrogateComponent.cxx index c5a8e15df0..61398f686f 100644 --- a/dtool/src/interrogatedb/interrogateComponent.cxx +++ b/dtool/src/interrogatedb/interrogateComponent.cxx @@ -16,13 +16,13 @@ // This static string is just kept around as a handy bogus return value for // functions that must return a const string reference. -string InterrogateComponent::_empty_string; +std::string InterrogateComponent::_empty_string; /** * Formats the component for output to a data file. */ void InterrogateComponent:: -output(ostream &out) const { +output(std::ostream &out) const { idf_output_string(out, _name); out << _alt_names.size() << " "; @@ -36,14 +36,14 @@ output(ostream &out) const { * Reads the data file as previously formatted by output(). */ void InterrogateComponent:: -input(istream &in) { +input(std::istream &in) { idf_input_string(in, _name); int num_alt_names; in >> num_alt_names; _alt_names.reserve(num_alt_names); for (int i = 0; i < num_alt_names; ++i) { - string alt_name; + std::string alt_name; idf_input_string(in, alt_name); _alt_names.push_back(alt_name); } diff --git a/dtool/src/interrogatedb/interrogateDatabase.cxx b/dtool/src/interrogatedb/interrogateDatabase.cxx index 8781e5c2bd..a8e7b37a6c 100644 --- a/dtool/src/interrogatedb/interrogateDatabase.cxx +++ b/dtool/src/interrogatedb/interrogateDatabase.cxx @@ -16,6 +16,9 @@ #include "indexRemapper.h" #include "interrogate_datafile.h" +using std::map; +using std::string; + InterrogateDatabase *InterrogateDatabase::_global_ptr = nullptr; int InterrogateDatabase::_file_major_version = 0; int InterrogateDatabase::_file_minor_version = 0; @@ -734,7 +737,7 @@ remap_indices(int first_index, IndexRemapper &remap) { * Writes the database to the indicated stream for later reading. */ void InterrogateDatabase:: -write(ostream &out, InterrogateModuleDef *def) const { +write(std::ostream &out, InterrogateModuleDef *def) const { // Write out the file header. out << def->file_identifier << "\n" << _current_major_version << " " << _current_minor_version << "\n"; @@ -793,7 +796,7 @@ write(ostream &out, InterrogateModuleDef *def) const { * Returns true if the file is read successfully, false if there is an error. */ bool InterrogateDatabase:: -read(istream &in, InterrogateModuleDef *def) { +read(std::istream &in, InterrogateModuleDef *def) { InterrogateDatabase temp; if (!temp.read_new(in, def)) { return false; @@ -899,7 +902,7 @@ load_latest() { * already has some data in it. */ bool InterrogateDatabase:: -read_new(istream &in, InterrogateModuleDef *def) { +read_new(std::istream &in, InterrogateModuleDef *def) { // We've already read the header. Read the module definition. idf_input_string(in, def->library_name); idf_input_string(in, def->library_hash_name); diff --git a/dtool/src/interrogatedb/interrogateElement.cxx b/dtool/src/interrogatedb/interrogateElement.cxx index 38c7c8f4ec..4b6b3d948f 100644 --- a/dtool/src/interrogatedb/interrogateElement.cxx +++ b/dtool/src/interrogatedb/interrogateElement.cxx @@ -20,7 +20,7 @@ * Formats the InterrogateElement data for output to a data file. */ void InterrogateElement:: -output(ostream &out) const { +output(std::ostream &out) const { InterrogateComponent::output(out); out << _flags << " " << _type << " " @@ -40,7 +40,7 @@ output(ostream &out) const { * Reads the data file as previously formatted by output(). */ void InterrogateElement:: -input(istream &in) { +input(std::istream &in) { InterrogateComponent::input(in); in >> _flags >> _type >> _getter >> _setter; if (InterrogateDatabase::get_file_minor_version() >= 1) { diff --git a/dtool/src/interrogatedb/interrogateFunction.cxx b/dtool/src/interrogatedb/interrogateFunction.cxx index a9a60264da..db70cc0b9c 100644 --- a/dtool/src/interrogatedb/interrogateFunction.cxx +++ b/dtool/src/interrogatedb/interrogateFunction.cxx @@ -58,7 +58,7 @@ operator = (const InterrogateFunction ©) { * Formats the InterrogateFunction data for output to a data file. */ void InterrogateFunction:: -output(ostream &out) const { +output(std::ostream &out) const { InterrogateComponent::output(out); out << _flags << " " << _class << " "; @@ -73,7 +73,7 @@ output(ostream &out) const { * Reads the data file as previously formatted by output(). */ void InterrogateFunction:: -input(istream &in) { +input(std::istream &in) { InterrogateComponent::input(in); in >> _flags >> _class; idf_input_string(in, _scoped_name); diff --git a/dtool/src/interrogatedb/interrogateFunctionWrapper.cxx b/dtool/src/interrogatedb/interrogateFunctionWrapper.cxx index 3cb143a2f3..9cad10ef4e 100644 --- a/dtool/src/interrogatedb/interrogateFunctionWrapper.cxx +++ b/dtool/src/interrogatedb/interrogateFunctionWrapper.cxx @@ -17,6 +17,9 @@ #include +using std::istream; +using std::ostream; + /** * */ diff --git a/dtool/src/interrogatedb/interrogateMakeSeq.cxx b/dtool/src/interrogatedb/interrogateMakeSeq.cxx index 68f3f5999e..d875a91809 100644 --- a/dtool/src/interrogatedb/interrogateMakeSeq.cxx +++ b/dtool/src/interrogatedb/interrogateMakeSeq.cxx @@ -19,7 +19,7 @@ * Formats the InterrogateMakeSeq data for output to a data file. */ void InterrogateMakeSeq:: -output(ostream &out) const { +output(std::ostream &out) const { InterrogateComponent::output(out); out << _length_getter << " " << _element_getter << " "; @@ -31,7 +31,7 @@ output(ostream &out) const { * Reads the data file as previously formatted by output(). */ void InterrogateMakeSeq:: -input(istream &in) { +input(std::istream &in) { InterrogateComponent::input(in); in >> _length_getter >> _element_getter; diff --git a/dtool/src/interrogatedb/interrogateManifest.cxx b/dtool/src/interrogatedb/interrogateManifest.cxx index 5257b85aaf..a078e868f4 100644 --- a/dtool/src/interrogatedb/interrogateManifest.cxx +++ b/dtool/src/interrogatedb/interrogateManifest.cxx @@ -19,7 +19,7 @@ * Formats the InterrogateManifest data for output to a data file. */ void InterrogateManifest:: -output(ostream &out) const { +output(std::ostream &out) const { InterrogateComponent::output(out); out << _flags << " " << _int_value << " " @@ -32,7 +32,7 @@ output(ostream &out) const { * Reads the data file as previously formatted by output(). */ void InterrogateManifest:: -input(istream &in) { +input(std::istream &in) { InterrogateComponent::input(in); in >> _flags >> _int_value >> _type >> _getter; idf_input_string(in, _definition); diff --git a/dtool/src/interrogatedb/interrogateType.cxx b/dtool/src/interrogatedb/interrogateType.cxx index 41839ffbf7..a9b9404cd4 100644 --- a/dtool/src/interrogatedb/interrogateType.cxx +++ b/dtool/src/interrogatedb/interrogateType.cxx @@ -18,6 +18,9 @@ #include +using std::istream; +using std::ostream; + /** * */ diff --git a/dtool/src/interrogatedb/interrogate_datafile.cxx b/dtool/src/interrogatedb/interrogate_datafile.cxx index 65cc3f3fef..a61defb368 100644 --- a/dtool/src/interrogatedb/interrogate_datafile.cxx +++ b/dtool/src/interrogatedb/interrogate_datafile.cxx @@ -13,6 +13,10 @@ #include "interrogate_datafile.h" +using std::istream; +using std::ostream; +using std::string; + /** * Writes the indicated string to the output file. Uses the given whitespace diff --git a/dtool/src/interrogatedb/interrogate_interface.cxx b/dtool/src/interrogatedb/interrogate_interface.cxx index 5f72f967e0..2cd08d4adf 100644 --- a/dtool/src/interrogatedb/interrogate_interface.cxx +++ b/dtool/src/interrogatedb/interrogate_interface.cxx @@ -17,6 +17,8 @@ #include "interrogateFunction.h" #include "config_interrogatedb.h" +using std::string; + // This function adds one more directory to the list of directories search for // interrogate (*.in) files. In the past, this list has been defined the // environment variable ETC_PATH, but now it is passed in by the code diff --git a/dtool/src/interrogatedb/py_panda.cxx b/dtool/src/interrogatedb/py_panda.cxx index ee2966789f..7e867aacad 100644 --- a/dtool/src/interrogatedb/py_panda.cxx +++ b/dtool/src/interrogatedb/py_panda.cxx @@ -17,6 +17,8 @@ #ifdef HAVE_PYTHON +using std::string; + PyMemberDef standard_type_members[] = { {(char *)"this", (sizeof(void*) == sizeof(int)) ? T_UINT : T_ULONGLONG, offsetof(Dtool_PyInstDef, _ptr_to_object), READONLY, (char *)"C++ 'this' pointer, if any"}, {(char *)"this_ownership", T_BOOL, offsetof(Dtool_PyInstDef, _memory_rules), READONLY, (char *)"C++ 'this' ownership rules"}, @@ -425,7 +427,7 @@ void Dtool_Accum_MethDefs(PyMethodDef in[], MethodDefmap &themap) { // are uniquly defined by an integer. void RegisterNamedClass(const string &name, Dtool_PyTypedObject &otype) { - pair result = + std::pair result = named_type_map.insert(NamedTypeMap::value_type(name, &otype)); if (!result.second) { @@ -450,7 +452,7 @@ RegisterRuntimeTypedClass(Dtool_PyTypedObject &otype) { << " has an illegal TypeHandle value; check that init_type() is called.\n"; } else { - pair result = + std::pair result = runtime_type_map.insert(RuntimeTypeMap::value_type(type_index, &otype)); if (!result.second) { // There was already an entry in the dictionary for type_index. @@ -531,7 +533,7 @@ PyObject *Dtool_PyModuleInitHelper(LibraryDef *defs[], const char *modulename) { version[2] != '0' + PY_MINOR_VERSION) { // Raise a helpful error message. We can safely do this because the // signature and behavior for PyErr_SetString has remained consistent. - ostringstream errs; + std::ostringstream errs; errs << "this module was compiled for Python " << PY_MAJOR_VERSION << "." << PY_MINOR_VERSION << ", which is " << "incompatible with Python " << version.substr(0, 3); diff --git a/dtool/src/interrogatedb/py_wrappers.cxx b/dtool/src/interrogatedb/py_wrappers.cxx index f03d727bd3..c09df0d5ab 100644 --- a/dtool/src/interrogatedb/py_wrappers.cxx +++ b/dtool/src/interrogatedb/py_wrappers.cxx @@ -377,7 +377,7 @@ static PyObject *Dtool_MutableSequenceWrapper_insert(PyObject *self, PyObject *a return PyErr_Format(PyExc_TypeError, "%s.insert() does not support negative indices", wrap->_base._name); } } - return wrap->_insert_func(wrap->_base._self, (ssize_t)max(index, (Py_ssize_t)0), PyTuple_GET_ITEM(args, 1)); + return wrap->_insert_func(wrap->_base._self, (ssize_t)std::max(index, (Py_ssize_t)0), PyTuple_GET_ITEM(args, 1)); } /** diff --git a/dtool/src/prc/androidLogStream.cxx b/dtool/src/prc/androidLogStream.cxx index 2dd32f7c5b..ef05db96ee 100644 --- a/dtool/src/prc/androidLogStream.cxx +++ b/dtool/src/prc/androidLogStream.cxx @@ -56,7 +56,7 @@ AndroidLogStream::AndroidLogStreamBuf:: */ int AndroidLogStream::AndroidLogStreamBuf:: sync() { - streamsize n = pptr() - pbase(); + std::streamsize n = pptr() - pbase(); // Write the characters that remain in the buffer. for (char *p = pbase(); p < pptr(); ++p) { @@ -73,7 +73,7 @@ sync() { */ int AndroidLogStream::AndroidLogStreamBuf:: overflow(int ch) { - streamsize n = pptr() - pbase(); + std::streamsize n = pptr() - pbase(); if (n != 0 && sync() != 0) { return EOF; @@ -107,7 +107,7 @@ write_char(char c) { */ AndroidLogStream:: AndroidLogStream(int priority) : - ostream(new AndroidLogStreamBuf(priority)) { + std::ostream(new AndroidLogStreamBuf(priority)) { } /** @@ -122,7 +122,7 @@ AndroidLogStream:: * Returns an AndroidLogStream suitable for writing log messages with the * indicated severity. */ -ostream &AndroidLogStream:: +std::ostream &AndroidLogStream:: out(NotifySeverity severity) { static AndroidLogStream* streams[NS_fatal + 1] = {nullptr}; diff --git a/dtool/src/prc/configDeclaration.cxx b/dtool/src/prc/configDeclaration.cxx index d692bec013..7cbfa5ba6e 100644 --- a/dtool/src/prc/configDeclaration.cxx +++ b/dtool/src/prc/configDeclaration.cxx @@ -17,6 +17,8 @@ #include "pstrtod.h" #include "string_utils.h" +using std::string; + /** * Use the ConfigPage::make_declaration() interface to create a new * declaration. @@ -133,7 +135,7 @@ set_double_word(size_t n, double value) { * */ void ConfigDeclaration:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_variable()->get_name() << " " << get_string_value(); } @@ -141,7 +143,7 @@ output(ostream &out) const { * */ void ConfigDeclaration:: -write(ostream &out) const { +write(std::ostream &out) const { out << get_variable()->get_name() << " " << get_string_value(); // if (!get_variable()->is_used()) { out << " (not used)"; } out << "\n"; diff --git a/dtool/src/prc/configFlags.cxx b/dtool/src/prc/configFlags.cxx index 7d9fb90eec..4613dc4615 100644 --- a/dtool/src/prc/configFlags.cxx +++ b/dtool/src/prc/configFlags.cxx @@ -18,8 +18,8 @@ TVOLATILE AtomicAdjust::Integer ConfigFlags::_global_modified; /** * */ -ostream & -operator << (ostream &out, ConfigFlags::ValueType type) { +std::ostream & +operator << (std::ostream &out, ConfigFlags::ValueType type) { switch (type) { case ConfigFlags::VT_undefined: return out << "undefined"; diff --git a/dtool/src/prc/configPage.cxx b/dtool/src/prc/configPage.cxx index ce515529c2..b7f1d06bd9 100644 --- a/dtool/src/prc/configPage.cxx +++ b/dtool/src/prc/configPage.cxx @@ -25,6 +25,10 @@ #include "openssl/evp.h" #endif +using std::istream; +using std::ostream; +using std::string; + ConfigPage *ConfigPage::_default_page = nullptr; ConfigPage *ConfigPage::_local_page = nullptr; @@ -340,7 +344,7 @@ output(ostream &out) const { */ void ConfigPage:: output_brief_signature(ostream &out) const { - size_t num_bytes = min(_signature.size(), (size_t)8); + size_t num_bytes = std::min(_signature.size(), (size_t)8); for (size_t p = 0; p < num_bytes; ++p) { unsigned int byte = _signature[p]; diff --git a/dtool/src/prc/configPageManager.cxx b/dtool/src/prc/configPageManager.cxx index fafaa6fa07..18f8b12784 100644 --- a/dtool/src/prc/configPageManager.cxx +++ b/dtool/src/prc/configPageManager.cxx @@ -38,6 +38,8 @@ #include #include +using std::string; + ConfigPageManager *ConfigPageManager::_global_ptr = nullptr; /** @@ -241,7 +243,7 @@ reload_implicit_pages() { // Use a set to ensure that we only visit each directory once, even if it // appears multiple times (under different aliases!) in the path. - set unique_dirnames; + std::set unique_dirnames; // We walk through the list of directories in forward order, so that the // most important directories are visited first. @@ -447,7 +449,7 @@ delete_explicit_page(ConfigPage *page) { * */ void ConfigPageManager:: -output(ostream &out) const { +output(std::ostream &out) const { out << "ConfigPageManager, " << _explicit_pages.size() + _implicit_pages.size() << " pages."; @@ -457,7 +459,7 @@ output(ostream &out) const { * */ void ConfigPageManager:: -write(ostream &out) const { +write(std::ostream &out) const { check_sort_pages(); out << _explicit_pages.size() << " explicit pages:\n"; @@ -558,7 +560,7 @@ scan_auto_prc_dir(Filename &prc_dir) const { } // Didn't find it; too bad. - cerr << "Warning: unable to auto-locate config files in directory named by \"" + std::cerr << "Warning: unable to auto-locate config files in directory named by \"" << prc_dir << "\".\n"; return false; } diff --git a/dtool/src/prc/configVariableBase.cxx b/dtool/src/prc/configVariableBase.cxx index 55643704b7..0b4e728b94 100644 --- a/dtool/src/prc/configVariableBase.cxx +++ b/dtool/src/prc/configVariableBase.cxx @@ -21,9 +21,9 @@ ConfigVariableBase::Unconstructed *ConfigVariableBase::_unconstructed; * ConfigVariableFoo derived class. */ ConfigVariableBase:: -ConfigVariableBase(const string &name, +ConfigVariableBase(const std::string &name, ConfigVariableBase::ValueType value_type, - const string &description, int flags) : + const std::string &description, int flags) : _core(ConfigVariableManager::get_global_ptr()->make_variable(name)) { #ifndef NDEBUG diff --git a/dtool/src/prc/configVariableCore.cxx b/dtool/src/prc/configVariableCore.cxx index b2ab7d277a..8ae104efd8 100644 --- a/dtool/src/prc/configVariableCore.cxx +++ b/dtool/src/prc/configVariableCore.cxx @@ -23,6 +23,8 @@ #include +using std::string; + /** * Use the ConfigVariableManager::make_variable() interface to create a new @@ -126,9 +128,9 @@ set_flags(int flags) { if ((bits_changed & ~(F_trust_level_mask | F_dconfig)) != 0) { prc_cat->warning() << "changing flags for ConfigVariable " - << get_name() << " from " << hex + << get_name() << " from " << std::hex << (_flags & ~F_trust_level_mask) << " to " - << (flags & ~F_trust_level_mask) << dec << ".\n"; + << (flags & ~F_trust_level_mask) << std::dec << ".\n"; } } @@ -325,7 +327,7 @@ get_declaration(size_t n) const { * */ void ConfigVariableCore:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_declaration(0)->get_string_value(); } @@ -333,7 +335,7 @@ output(ostream &out) const { * */ void ConfigVariableCore:: -write(ostream &out) const { +write(std::ostream &out) const { out << "ConfigVariable " << get_name() << ":\n"; check_sort_declarations(); diff --git a/dtool/src/prc/configVariableList.cxx b/dtool/src/prc/configVariableList.cxx index 7ecd861837..f663ac5adc 100644 --- a/dtool/src/prc/configVariableList.cxx +++ b/dtool/src/prc/configVariableList.cxx @@ -17,7 +17,7 @@ * */ void ConfigVariableList:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_num_values() << " values."; } @@ -25,7 +25,7 @@ output(ostream &out) const { * */ void ConfigVariableList:: -write(ostream &out) const { +write(std::ostream &out) const { size_t num_values = get_num_values(); for (size_t i = 0; i < num_values; ++i) { out << get_string_value(i) << "\n"; diff --git a/dtool/src/prc/configVariableManager.cxx b/dtool/src/prc/configVariableManager.cxx index 52f7269f6b..774dc19f6b 100644 --- a/dtool/src/prc/configVariableManager.cxx +++ b/dtool/src/prc/configVariableManager.cxx @@ -17,6 +17,8 @@ #include "configPage.h" #include "config_prc.h" +using std::string; + ConfigVariableManager *ConfigVariableManager::_global_ptr = nullptr; /** @@ -180,7 +182,7 @@ is_variable_used(size_t n) const { * */ void ConfigVariableManager:: -output(ostream &out) const { +output(std::ostream &out) const { out << "ConfigVariableManager, " << _variables.size() << " variables."; } @@ -188,7 +190,7 @@ output(ostream &out) const { * */ void ConfigVariableManager:: -write(ostream &out) const { +write(std::ostream &out) const { VariablesByName::const_iterator ni; for (ni = _variables_by_name.begin(); ni != _variables_by_name.end(); @@ -211,7 +213,7 @@ write(ostream &out) const { * state. */ void ConfigVariableManager:: -write_prc_variables(ostream &out) const { +write_prc_variables(std::ostream &out) const { VariablesByName::const_iterator ni; for (ni = _variables_by_name.begin(); ni != _variables_by_name.end(); diff --git a/dtool/src/prc/configVariableSearchPath.cxx b/dtool/src/prc/configVariableSearchPath.cxx index 984ba435c7..2231626a7a 100644 --- a/dtool/src/prc/configVariableSearchPath.cxx +++ b/dtool/src/prc/configVariableSearchPath.cxx @@ -32,7 +32,7 @@ reload_search_path() { Filename page_filename(page->get_name()); Filename page_dirname = page_filename.get_dirname(); ExecutionEnvironment::shadow_environment_variable("THIS_PRC_DIR", page_dirname.to_os_specific()); - string expanded = ExecutionEnvironment::expand_string(decl->get_string_value()); + std::string expanded = ExecutionEnvironment::expand_string(decl->get_string_value()); ExecutionEnvironment::clear_shadow("THIS_PRC_DIR"); if (!expanded.empty()) { Filename dir = Filename::from_os_specific(expanded); diff --git a/dtool/src/prc/encryptStreamBuf.cxx b/dtool/src/prc/encryptStreamBuf.cxx index 1fd5cc72b5..192c1181c6 100644 --- a/dtool/src/prc/encryptStreamBuf.cxx +++ b/dtool/src/prc/encryptStreamBuf.cxx @@ -101,7 +101,7 @@ EncryptStreamBuf:: * */ void EncryptStreamBuf:: -open_read(istream *source, bool owns_source, const string &password) { +open_read(std::istream *source, bool owns_source, const std::string &password) { OpenSSL_add_all_algorithms(); _source = source; @@ -208,7 +208,7 @@ close_read() { * */ void EncryptStreamBuf:: -open_write(ostream *dest, bool owns_dest, const string &password) { +open_write(std::ostream *dest, bool owns_dest, const std::string &password) { OpenSSL_add_all_algorithms(); close_write(); @@ -408,7 +408,7 @@ read_chars(char *start, size_t length) { if (_in_read_overflow_buffer != 0) { // Take from the overflow buffer. - length = min(length, _in_read_overflow_buffer); + length = std::min(length, _in_read_overflow_buffer); memcpy(start, _read_overflow_buffer, length); _in_read_overflow_buffer -= length; memcpy(_read_overflow_buffer + length, _read_overflow_buffer, _in_read_overflow_buffer); diff --git a/dtool/src/prc/notify.cxx b/dtool/src/prc/notify.cxx index 0d91f5b444..f9c39135e8 100644 --- a/dtool/src/prc/notify.cxx +++ b/dtool/src/prc/notify.cxx @@ -29,6 +29,12 @@ #include #endif +using std::cerr; +using std::cout; +using std::ostream; +using std::ostringstream; +using std::string; + Notify *Notify::_global_ptr = nullptr; /** @@ -101,7 +107,7 @@ get_literal_flag() { if (!got_flag) { #ifndef PHAVE_IOSTREAM - flag = ios::bitalloc(); + flag = std::ios::bitalloc(); #else // We lost bitalloc in the new iostream? Ok, this feature will just be // disabled for now. No big deal. @@ -187,7 +193,7 @@ get_category(const string &basename, NotifyCategory *parent_category) { } } - pair result = + std::pair result = _categories.insert(Categories::value_type(fullname, nullptr)); bool inserted = result.second; @@ -430,7 +436,7 @@ config_initialized() { if (!notify_output.empty()) { if (notify_output == "stdout") { - cout.setf(ios::unitbuf); + cout.setf(std::ios::unitbuf); set_ostream_ptr(&cout, false); } else if (notify_output == "stderr") { @@ -459,7 +465,7 @@ config_initialized() { nout << "Unable to open file " << filename << " for output.\n"; delete out; } else { - out->setf(ios::unitbuf); + out->setf(std::ios::unitbuf); set_ostream_ptr(out, true); } #endif // BUILD_IPHONE diff --git a/dtool/src/prc/notifyCategory.cxx b/dtool/src/prc/notifyCategory.cxx index 8faa89bdd0..11a3c52587 100644 --- a/dtool/src/prc/notifyCategory.cxx +++ b/dtool/src/prc/notifyCategory.cxx @@ -31,7 +31,7 @@ long NotifyCategory::_server_delta = 0; * */ NotifyCategory:: -NotifyCategory(const string &fullname, const string &basename, +NotifyCategory(const std::string &fullname, const std::string &basename, NotifyCategory *parent) : _fullname(fullname), _basename(basename), @@ -55,7 +55,7 @@ NotifyCategory(const string &fullname, const string &basename, * the Notify::out() stream and returns that. If the severity level is * disabled, this returns Notify::null(). */ -ostream &NotifyCategory:: +std::ostream &NotifyCategory:: out(NotifySeverity severity, bool prefix) const { if (is_on(severity)) { @@ -151,9 +151,9 @@ set_server_delta(long delta) { * Returns the name of the config variable that controls this category. This * is called at construction time. */ -string NotifyCategory:: +std::string NotifyCategory:: get_config_name() const { - string config_name; + std::string config_name; if (_fullname.empty()) { config_name = "notify-level"; diff --git a/dtool/src/prc/notifySeverity.cxx b/dtool/src/prc/notifySeverity.cxx index 0ee750e879..d6547e8de1 100644 --- a/dtool/src/prc/notifySeverity.cxx +++ b/dtool/src/prc/notifySeverity.cxx @@ -14,6 +14,10 @@ #include "notifySeverity.h" #include "pnotify.h" +using std::istream; +using std::ostream; +using std::string; + ostream & operator << (ostream &out, NotifySeverity severity) { switch (severity) { diff --git a/dtool/src/prc/streamReader.cxx b/dtool/src/prc/streamReader.cxx index e9fa173ad1..74f278e220 100644 --- a/dtool/src/prc/streamReader.cxx +++ b/dtool/src/prc/streamReader.cxx @@ -14,6 +14,8 @@ #include "streamReader.h" #include "memoryHook.h" +using std::string; + /** * Extracts a variable-length string. diff --git a/dtool/src/prc/streamReader_ext.cxx b/dtool/src/prc/streamReader_ext.cxx index 53a4570872..94c346e370 100644 --- a/dtool/src/prc/streamReader_ext.cxx +++ b/dtool/src/prc/streamReader_ext.cxx @@ -41,9 +41,9 @@ extract_bytes(size_t size) { */ PyObject *Extension:: readline() { - istream *in = _this->get_istream(); + std::istream *in = _this->get_istream(); - string line; + std::string line; int ch = in->get(); while (!in->eof() && !in->fail()) { line += ch; diff --git a/dtool/src/prc/streamWrapper.cxx b/dtool/src/prc/streamWrapper.cxx index 68f8e47abb..3c59fb3a90 100644 --- a/dtool/src/prc/streamWrapper.cxx +++ b/dtool/src/prc/streamWrapper.cxx @@ -13,6 +13,8 @@ #include "streamWrapper.h" +using std::streamsize; + /** * */ @@ -121,7 +123,7 @@ streamsize IStreamWrapper:: seek_gpos_eof() { streamsize pos; acquire(); - _istream->seekg(0, ios::end); + _istream->seekg(0, std::ios::end); pos = _istream->tellg(); release(); @@ -204,7 +206,7 @@ void OStreamWrapper:: seek_eof_write(const char *buffer, streamsize num_bytes, bool &fail) { acquire(); _ostream->clear(); - _ostream->seekp(0, ios::end); + _ostream->seekp(0, std::ios::end); #ifdef WIN32_VC if (_ostream->fail() && _stringstream_hack) { @@ -228,7 +230,7 @@ streamsize OStreamWrapper:: seek_ppos_eof() { streamsize pos; acquire(); - _ostream->seekp(0, ios::end); + _ostream->seekp(0, std::ios::end); #ifdef WIN32_VC if (_ostream->fail() && _stringstream_hack) { diff --git a/dtool/src/prckeys/makePrcKey.cxx b/dtool/src/prckeys/makePrcKey.cxx index 48b8f62d9c..a6ee834b04 100644 --- a/dtool/src/prckeys/makePrcKey.cxx +++ b/dtool/src/prckeys/makePrcKey.cxx @@ -30,6 +30,9 @@ #include "openssl/rand.h" #include "openssl/bio.h" +using std::cerr; +using std::string; + class KeyNumber { public: int _number; @@ -69,7 +72,7 @@ output_ssl_errors() { * string. */ void -output_c_string(ostream &out, const string &string_name, +output_c_string(std::ostream &out, const string &string_name, size_t index, BIO *mbio) { char *data_ptr; size_t data_size = BIO_get_mem_data(mbio, &data_ptr); @@ -94,8 +97,8 @@ output_c_string(ostream &out, const string &string_name, out << data_ptr[i]; } else { - out << "\\x" << hex << setw(2) << setfill('0') - << (unsigned int)(unsigned char)data_ptr[i] << dec; + out << "\\x" << std::hex << std::setw(2) << std::setfill('0') + << (unsigned int)(unsigned char)data_ptr[i] << std::dec; } } } @@ -456,7 +459,7 @@ main(int argc, char **argv) { EVP_PKEY *pkey = generate_key(); PrcKeyRegistry::get_global_ptr()->set_key(n, pkey, now); - ostringstream strm; + std::ostringstream strm; if (got_hash || n != 1) { // If we got an explicit hash mark, we always output the number. If we // did not get an explicit hash mark, we output the number only if it is diff --git a/dtool/src/prckeys/signPrcFile_src.cxx b/dtool/src/prckeys/signPrcFile_src.cxx index f122283c55..5e9d04a1b4 100644 --- a/dtool/src/prckeys/signPrcFile_src.cxx +++ b/dtool/src/prckeys/signPrcFile_src.cxx @@ -30,6 +30,9 @@ #include "openssl/bio.h" #include "openssl/evp.h" +using std::cerr; +using std::string; + string progname = PROGNAME; /** @@ -77,7 +80,7 @@ read_prc_line(const string &line, string &data) { * indicated string. */ void -read_file(istream &in, string &data) { +read_file(std::istream &in, string &data) { // We avoid getline() here because of its notorious problem with last lines // that lack a trailing newline character. static const size_t buffer_size = 1024; @@ -129,7 +132,7 @@ read_file(istream &in, string &data) { * Outputs the indicated data stream as a series of hex digits. */ void -output_hex(ostream &out, const unsigned char *data, size_t size) { +output_hex(std::ostream &out, const unsigned char *data, size_t size) { } /** @@ -155,7 +158,7 @@ sign_prc(Filename filename, bool no_comments, EVP_PKEY *pkey) { } // Append the comments before the signature (these get signed too). - ostringstream strm; + std::ostringstream strm; strm << "##!\n"; if (!no_comments) { time_t now = time(nullptr); @@ -203,7 +206,7 @@ sign_prc(Filename filename, bool no_comments, EVP_PKEY *pkey) { } cerr << "Rewriting " << filename << "\n"; - out << data << hex << setfill('0'); + out << data << std::hex << std::setfill('0'); static const size_t row_width = 32; for (size_t p = 0; p < sig_size; p += row_width) { out << "##!sig "; @@ -214,11 +217,11 @@ sign_prc(Filename filename, bool no_comments, EVP_PKEY *pkey) { end = p+row_width; for (size_t q = p; q < end; q++) { - out << setw(2) << (unsigned int)sig_data[q]; + out << std::setw(2) << (unsigned int)sig_data[q]; } out << "\n"; } - out << dec; + out << std::dec; delete[] sig_data; } diff --git a/dtool/src/test_interrogate/test_interrogate.cxx b/dtool/src/test_interrogate/test_interrogate.cxx index 9a5c6dfc16..590b8ac873 100644 --- a/dtool/src/test_interrogate/test_interrogate.cxx +++ b/dtool/src/test_interrogate/test_interrogate.cxx @@ -23,6 +23,11 @@ #include +using std::cerr; +using std::cout; +using std::ostream; +using std::string; + static ostream & indent(ostream &out, int indent_level) { for (int i = 0; i < indent_level; i++) { diff --git a/dtool/src/test_interrogate/test_lib.cxx b/dtool/src/test_interrogate/test_lib.cxx index cab224118c..89ccafccfc 100644 --- a/dtool/src/test_interrogate/test_lib.cxx +++ b/dtool/src/test_interrogate/test_lib.cxx @@ -34,7 +34,7 @@ int stupid_global; Configure(test_lib); ConfigureFn(test_lib) { - cerr << "In test_lib configure function!" << endl; + std::cerr << "In test_lib configure function!" << std::endl; } ConfigureLibSym; diff --git a/panda/src/android/android_main.cxx b/panda/src/android/android_main.cxx index 865936e2ed..626111ed83 100644 --- a/panda/src/android/android_main.cxx +++ b/panda/src/android/android_main.cxx @@ -26,6 +26,8 @@ #include #include +using std::string; + // struct android_app* panda_android_app = NULL; extern int main(int argc, const char **argv); @@ -197,7 +199,7 @@ void android_main(struct android_app* app) { get_model_path().append_directory(asset_dir); // Now load the configuration files. - vector pages; + std::vector pages; ConfigPageManager *cp_mgr; AAssetDir *etc = AAssetManager_openDir(app->activity->assetManager, "etc"); if (etc != nullptr) { @@ -209,7 +211,7 @@ void android_main(struct android_app* app) { GlobPattern pattern = cp_mgr->get_prc_pattern(i); if (pattern.matches(filename)) { Filename prc_fn("etc", filename); - istream *in = asset_mount->open_read_file(prc_fn); + std::istream *in = asset_mount->open_read_file(prc_fn); if (in != nullptr) { ConfigPage *page = cp_mgr->make_explicit_page(Filename("/android_asset", prc_fn)); page->read_prc(*in); diff --git a/panda/src/android/config_android.cxx b/panda/src/android/config_android.cxx index aa527cefc3..083cd7c192 100644 --- a/panda/src/android/config_android.cxx +++ b/panda/src/android/config_android.cxx @@ -139,7 +139,7 @@ void JNI_OnUnload(JavaVM *jvm, void *reserved) { * Shows a toast notification at the bottom of the activity. The duration * should be 0 for short and 1 for long. */ -void android_show_toast(ANativeActivity *activity, const string &message, int duration) { +void android_show_toast(ANativeActivity *activity, const std::string &message, int duration) { Thread *thread = Thread::get_current_thread(); JNIEnv *env = thread->get_jni_env(); nassertv(env != nullptr); diff --git a/panda/src/android/pnmFileTypeAndroid.cxx b/panda/src/android/pnmFileTypeAndroid.cxx index aa25b2c777..535cc30563 100644 --- a/panda/src/android/pnmFileTypeAndroid.cxx +++ b/panda/src/android/pnmFileTypeAndroid.cxx @@ -27,7 +27,7 @@ PNMFileTypeAndroid(CompressFormat format) : _format(format) { /** * Returns a few words describing the file type. */ -string PNMFileTypeAndroid:: +std::string PNMFileTypeAndroid:: get_name() const { return "Android Bitmap"; } @@ -54,7 +54,7 @@ get_num_extensions() const { * Returns the nth possible filename extension associated with this particular * file type, without a leading dot. */ -string PNMFileTypeAndroid:: +std::string PNMFileTypeAndroid:: get_extension(int n) const { static const char *const jpeg_extensions[] = {"jpg", "jpeg", "jpe"}; switch (_format) { @@ -84,7 +84,7 @@ has_magic_number() const { * returns NULL. */ PNMReader *PNMFileTypeAndroid:: -make_reader(istream *file, bool owns_file, const string &magic_number) { +make_reader(std::istream *file, bool owns_file, const std::string &magic_number) { return new Reader(this, file, owns_file, magic_number); } @@ -94,7 +94,7 @@ make_reader(istream *file, bool owns_file, const string &magic_number) { * NULL. */ PNMWriter *PNMFileTypeAndroid:: -make_writer(ostream *file, bool owns_file) { +make_writer(std::ostream *file, bool owns_file) { return new Writer(this, file, owns_file, _format); } diff --git a/panda/src/android/pnmFileTypeAndroidReader.cxx b/panda/src/android/pnmFileTypeAndroidReader.cxx index 797571a311..7feceffa1c 100644 --- a/panda/src/android/pnmFileTypeAndroidReader.cxx +++ b/panda/src/android/pnmFileTypeAndroidReader.cxx @@ -60,11 +60,11 @@ static void conv_rgba4444(uint16_t in, xel &rgb, xelval &alpha) { * */ PNMFileTypeAndroid::Reader:: -Reader(PNMFileType *type, istream *file, bool owns_file, string magic_number) : +Reader(PNMFileType *type, std::istream *file, bool owns_file, std::string magic_number) : PNMReader(type, file, owns_file), _bitmap(nullptr) { // Hope we can putback() more than one character. - for (string::reverse_iterator mi = magic_number.rbegin(); + for (std::string::reverse_iterator mi = magic_number.rbegin(); mi != magic_number.rend(); ++mi) { _file->putback(*mi); }; @@ -75,7 +75,7 @@ Reader(PNMFileType *type, istream *file, bool owns_file, string magic_number) : return; } - streampos pos = _file->tellg(); + std::streampos pos = _file->tellg(); Thread *current_thread = Thread::get_current_thread(); _env = current_thread->get_jni_env(); @@ -143,7 +143,7 @@ prepare_read() { int x_reduction = _orig_x_size / _read_x_size; int y_reduction = _orig_y_size / _read_y_size; - _sample_size = max(min(x_reduction, y_reduction), 1); + _sample_size = std::max(std::min(x_reduction, y_reduction), 1); } _bitmap = _env->CallStaticObjectMethod(jni_PandaActivity, diff --git a/panda/src/android/pnmFileTypeAndroidWriter.cxx b/panda/src/android/pnmFileTypeAndroidWriter.cxx index 4677a25cbd..3157733115 100644 --- a/panda/src/android/pnmFileTypeAndroidWriter.cxx +++ b/panda/src/android/pnmFileTypeAndroidWriter.cxx @@ -34,7 +34,7 @@ enum class BitmapConfig : jint { * */ PNMFileTypeAndroid::Writer:: -Writer(PNMFileType *type, ostream *file, bool owns_file, +Writer(PNMFileType *type, std::ostream *file, bool owns_file, CompressFormat format) : PNMWriter(type, file, owns_file), _format(format) diff --git a/panda/src/android/python_main.cxx b/panda/src/android/python_main.cxx index c1fc0a39fe..0e4059c61c 100644 --- a/panda/src/android/python_main.cxx +++ b/panda/src/android/python_main.cxx @@ -38,7 +38,7 @@ int main(int argc, char *argv[]) { Py_SetProgramName(Py_DecodeLocale("ppython", nullptr)); // Set PYTHONHOME to the location of the .apk file. - string apk_path = ExecutionEnvironment::get_binary_name(); + std::string apk_path = ExecutionEnvironment::get_binary_name(); Py_SetPythonHome(Py_DecodeLocale(apk_path.c_str(), nullptr)); // We need to make zlib available to zipimport, but I don't know how @@ -56,7 +56,7 @@ int main(int argc, char *argv[]) { // This is used by the import hook to locate the module libraries. Filename dtool_name = ExecutionEnvironment::get_dtool_name(); - string native_dir = dtool_name.get_dirname(); + std::string native_dir = dtool_name.get_dirname(); PyObject *py_native_dir = PyUnicode_FromStringAndSize(native_dir.c_str(), native_dir.size()); PySys_SetObject("_native_library_dir", py_native_dir); Py_DECREF(py_native_dir); diff --git a/panda/src/androiddisplay/androidGraphicsPipe.cxx b/panda/src/androiddisplay/androidGraphicsPipe.cxx index 673a03e5a2..53f0f72310 100644 --- a/panda/src/androiddisplay/androidGraphicsPipe.cxx +++ b/panda/src/androiddisplay/androidGraphicsPipe.cxx @@ -68,7 +68,7 @@ AndroidGraphicsPipe:: * choose between several possible GraphicsPipes available on a particular * platform, so the name should be meaningful and unique for a given platform. */ -string AndroidGraphicsPipe:: +std::string AndroidGraphicsPipe:: get_interface_name() const { return "OpenGL ES"; } @@ -99,7 +99,7 @@ AndroidGraphicsPipe::get_preferred_window_thread() const { * Creates a new window on the pipe, if possible. */ PT(GraphicsOutput) AndroidGraphicsPipe:: -make_output(const string &name, +make_output(const std::string &name, const FrameBufferProperties &fb_prop, const WindowProperties &win_prop, int flags, diff --git a/panda/src/androiddisplay/androidGraphicsStateGuardian.cxx b/panda/src/androiddisplay/androidGraphicsStateGuardian.cxx index 3d5b949633..e5c8177d9e 100644 --- a/panda/src/androiddisplay/androidGraphicsStateGuardian.cxx +++ b/panda/src/androiddisplay/androidGraphicsStateGuardian.cxx @@ -275,7 +275,7 @@ reset() { #endif // If "PixelFlinger" is present, assume software. - if (_gl_renderer.find("PixelFlinger") != string::npos) { + if (_gl_renderer.find("PixelFlinger") != std::string::npos) { _fbprops.set_force_software(1); _fbprops.set_force_hardware(0); } else { diff --git a/panda/src/androiddisplay/androidGraphicsWindow.cxx b/panda/src/androiddisplay/androidGraphicsWindow.cxx index 62755cdd2c..431f9419b7 100644 --- a/panda/src/androiddisplay/androidGraphicsWindow.cxx +++ b/panda/src/androiddisplay/androidGraphicsWindow.cxx @@ -38,7 +38,7 @@ TypeHandle AndroidGraphicsWindow::_type_handle; */ AndroidGraphicsWindow:: AndroidGraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe, - const string &name, + const std::string &name, const FrameBufferProperties &fb_prop, const WindowProperties &win_prop, int flags, diff --git a/panda/src/androiddisplay/config_androiddisplay.cxx b/panda/src/androiddisplay/config_androiddisplay.cxx index 6b344b6c9d..42b0fb8120 100644 --- a/panda/src/androiddisplay/config_androiddisplay.cxx +++ b/panda/src/androiddisplay/config_androiddisplay.cxx @@ -64,7 +64,7 @@ init_libandroiddisplay() { /** * Returns the given EGL error as string. */ -const string get_egl_error_string(int error) { +const std::string get_egl_error_string(int error) { switch (error) { case 0x3000: return "EGL_SUCCESS"; break; case 0x3001: return "EGL_NOT_INITIALIZED"; break; diff --git a/panda/src/audio/audioManager.cxx b/panda/src/audio/audioManager.cxx index 77d4c1a076..39d16156ef 100644 --- a/panda/src/audio/audioManager.cxx +++ b/panda/src/audio/audioManager.cxx @@ -25,6 +25,8 @@ #include // For GetSystemDirectory() #endif +using std::string; + TypeHandle AudioManager::_type_handle; @@ -312,7 +314,7 @@ get_dls_pathname() { * */ void AudioManager:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type(); } @@ -320,7 +322,7 @@ output(ostream &out) const { * */ void AudioManager:: -write(ostream &out) const { +write(std::ostream &out) const { out << (*this) << "\n"; } diff --git a/panda/src/audio/audioSound.cxx b/panda/src/audio/audioSound.cxx index 9d121e06b0..19cc27f030 100644 --- a/panda/src/audio/audioSound.cxx +++ b/panda/src/audio/audioSound.cxx @@ -14,6 +14,8 @@ #include "audioSound.h" +using std::ostream; + TypeHandle AudioSound::_type_handle; /** diff --git a/panda/src/audio/config_audio.cxx b/panda/src/audio/config_audio.cxx index 0f58e56a32..1ea8053eb6 100644 --- a/panda/src/audio/config_audio.cxx +++ b/panda/src/audio/config_audio.cxx @@ -25,6 +25,10 @@ #error Buildsystem error: BUILDING_PANDA_AUDIO not defined #endif +using std::istream; +using std::ostream; +using std::string; + Configure(config_audio); NotifyCategoryDef(audio, ""); diff --git a/panda/src/audio/nullAudioManager.cxx b/panda/src/audio/nullAudioManager.cxx index f7126e9b7b..dabeb8c825 100644 --- a/panda/src/audio/nullAudioManager.cxx +++ b/panda/src/audio/nullAudioManager.cxx @@ -49,7 +49,7 @@ is_valid() { * */ PT(AudioSound) NullAudioManager:: -get_sound(const string&, bool positional, int mode) { +get_sound(const std::string&, bool positional, int mode) { return get_null_sound(); } @@ -65,7 +65,7 @@ get_sound(MovieAudio *sound, bool positional, int mode) { * */ void NullAudioManager:: -uncache_sound(const string&) { +uncache_sound(const std::string&) { // intentionally blank. } diff --git a/panda/src/audio/nullAudioSound.cxx b/panda/src/audio/nullAudioSound.cxx index 980083b468..0fbdf14672 100644 --- a/panda/src/audio/nullAudioSound.cxx +++ b/panda/src/audio/nullAudioSound.cxx @@ -14,6 +14,8 @@ #include "nullAudioSound.h" +using std::string; + TypeHandle NullAudioSound::_type_handle; namespace { diff --git a/panda/src/audio/test_audio.cxx b/panda/src/audio/test_audio.cxx index a2a7ac06fb..612ad1bcb5 100644 --- a/panda/src/audio/test_audio.cxx +++ b/panda/src/audio/test_audio.cxx @@ -26,9 +26,9 @@ main(int argc, char* argv[]) { PT(AudioSound) tester = AudioPool::load_sound(argv[1]); AudioManager::play(tester); AudioPool::release_all_sounds(); - cerr << "all sounds but 1 released" << endl; + std::cerr << "all sounds but 1 released" << std::endl; } - cerr << "all sounds released" << endl; + std::cerr << "all sounds released" << std::endl; } /* diff --git a/panda/src/audiotraits/fmodAudioManager.cxx b/panda/src/audiotraits/fmodAudioManager.cxx index 529f6facb0..1f7ed7cd22 100644 --- a/panda/src/audiotraits/fmodAudioManager.cxx +++ b/panda/src/audiotraits/fmodAudioManager.cxx @@ -409,7 +409,7 @@ configure_filters(FilterProperties *config) { * This is what creates a sound instance. */ PT(AudioSound) FmodAudioManager:: -get_sound(const string &file_name, bool positional, int) { +get_sound(const std::string &file_name, bool positional, int) { ReMutexHolder holder(_lock); // Needed so People use Panda's Generic UNIX Style Paths for Filename. // path.to_os_specific() converts it back to the proper OS version later on. @@ -768,7 +768,7 @@ reduce_sounds_playing_to(unsigned int count) { * NOT USED FOR FMOD-EX!!! Clears a sound out of the sound cache. */ void FmodAudioManager:: -uncache_sound(const string& file_name) { +uncache_sound(const std::string& file_name) { audio_debug("FmodAudioManager::uncache_sound(\""< #endif +using std::istream; +using std::string; + GlobalMilesManager *GlobalMilesManager::_global_ptr; /** @@ -414,15 +417,15 @@ seek_callback(UINTa file_handle, S32 offset, U32 type) { strm->clear(); switch (type) { case AIL_FILE_SEEK_BEGIN: - strm->seekg(offset, ios::beg); + strm->seekg(offset, std::ios::beg); break; case AIL_FILE_SEEK_CURRENT: - strm->seekg(offset, ios::cur); + strm->seekg(offset, std::ios::cur); break; case AIL_FILE_SEEK_END: - strm->seekg(offset, ios::end); + strm->seekg(offset, std::ios::end); break; } diff --git a/panda/src/audiotraits/milesAudioManager.cxx b/panda/src/audiotraits/milesAudioManager.cxx index 24ed73d448..2aed1ce44b 100644 --- a/panda/src/audiotraits/milesAudioManager.cxx +++ b/panda/src/audiotraits/milesAudioManager.cxx @@ -31,6 +31,8 @@ #include +using std::string; + TypeHandle MilesAudioManager::_type_handle; @@ -153,7 +155,7 @@ get_sound(const string &file_name, bool, int) { } // Put it in the pool: The following is roughly like: _sounds[path] = // sd; But, it gives us an iterator into the map. - pair ib + std::pair ib = _sounds.insert(SoundMap::value_type(path, sd)); if (!ib.second) { // The insert failed. @@ -673,7 +675,7 @@ cleanup() { * */ void MilesAudioManager:: -output(ostream &out) const { +output(std::ostream &out) const { LightReMutexHolder holder(_lock); out << get_type() << ": " << _sounds_playing.size() << " / " << _sounds_on_loan.size() << " sounds playing / total"; @@ -683,7 +685,7 @@ output(ostream &out) const { * */ void MilesAudioManager:: -write(ostream &out) const { +write(std::ostream &out) const { LightReMutexHolder holder(_lock); out << (*this) << "\n"; @@ -899,7 +901,7 @@ load(const Filename &file_name) { bool is_midi_file = (downcase(extension) == "mid"); - if ((miles_audio_preload_threshold == -1 || file->get_file_size() < (streamsize)miles_audio_preload_threshold) || + if ((miles_audio_preload_threshold == -1 || file->get_file_size() < (std::streamsize)miles_audio_preload_threshold) || is_midi_file) { // If the file is sufficiently small, we'll preload it into memory. MIDI // files cannot be streamed, so we always preload them, regardless of diff --git a/panda/src/audiotraits/milesAudioSample.cxx b/panda/src/audiotraits/milesAudioSample.cxx index e953e77dad..8eb0ab2d26 100644 --- a/panda/src/audiotraits/milesAudioSample.cxx +++ b/panda/src/audiotraits/milesAudioSample.cxx @@ -34,7 +34,7 @@ TypeHandle MilesAudioSample::_type_handle; */ MilesAudioSample:: MilesAudioSample(MilesAudioManager *manager, MilesAudioManager::SoundData *sd, - const string &file_name) : + const std::string &file_name) : MilesAudioSound(manager, file_name), _sd(sd) { @@ -176,8 +176,8 @@ set_volume(PN_stdfloat volume) { // Change to Miles volume, range 0 to 1.0: F32 milesVolume = volume; - milesVolume = min(milesVolume, 1.0f); - milesVolume = max(milesVolume, 0.0f); + milesVolume = std::min(milesVolume, 1.0f); + milesVolume = std::max(milesVolume, 0.0f); // Convert balance of -1.0..1.0 to 0-1.0: F32 milesBalance = (F32)((_balance + 1.0f) * 0.5f); @@ -269,7 +269,7 @@ cleanup() { * */ void MilesAudioSample:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type() << " " << get_name() << " " << status(); if (!_sd.is_null()) { out << " " << (_sd->_raw_data.size() + 1023) / 1024 << "K"; diff --git a/panda/src/audiotraits/milesAudioSequence.cxx b/panda/src/audiotraits/milesAudioSequence.cxx index 9f16c0dd3d..b214644e54 100644 --- a/panda/src/audiotraits/milesAudioSequence.cxx +++ b/panda/src/audiotraits/milesAudioSequence.cxx @@ -34,7 +34,7 @@ TypeHandle MilesAudioSequence::_type_handle; */ MilesAudioSequence:: MilesAudioSequence(MilesAudioManager *manager, MilesAudioManager::SoundData *sd, - const string &file_name) : + const std::string &file_name) : MilesAudioSound(manager, file_name), _sd(sd) { @@ -166,8 +166,8 @@ set_volume(PN_stdfloat volume) { // Change to Miles volume, range 0 to 127: S32 milesVolume = (S32)(volume * 127.0f); - milesVolume = min(milesVolume, 127); - milesVolume = max(milesVolume, 0); + milesVolume = std::min(milesVolume, 127); + milesVolume = std::max(milesVolume, 0); AIL_set_sequence_volume(_sequence, milesVolume, 0); } @@ -296,7 +296,7 @@ do_set_time(PN_stdfloat time) { // Ensure we don't inadvertently run off the end of the sound. S32 length_ms; AIL_sequence_ms_position(_sequence, &length_ms, nullptr); - time_ms = min(time_ms, length_ms); + time_ms = std::min(time_ms, length_ms); AIL_set_sequence_ms_position(_sequence, time_ms); } diff --git a/panda/src/audiotraits/milesAudioSound.cxx b/panda/src/audiotraits/milesAudioSound.cxx index de9d0edcff..75ca1d012b 100644 --- a/panda/src/audiotraits/milesAudioSound.cxx +++ b/panda/src/audiotraits/milesAudioSound.cxx @@ -16,6 +16,8 @@ #include "milesAudioManager.h" +using std::string; + TypeHandle MilesAudioSound::_type_handle; #undef miles_audio_debug diff --git a/panda/src/audiotraits/milesAudioStream.cxx b/panda/src/audiotraits/milesAudioStream.cxx index debf8dd08a..480d35c81c 100644 --- a/panda/src/audiotraits/milesAudioStream.cxx +++ b/panda/src/audiotraits/milesAudioStream.cxx @@ -32,7 +32,7 @@ TypeHandle MilesAudioStream::_type_handle; * */ MilesAudioStream:: -MilesAudioStream(MilesAudioManager *manager, const string &file_name, +MilesAudioStream(MilesAudioManager *manager, const std::string &file_name, const Filename &path) : MilesAudioSound(manager, file_name), _path(path) @@ -173,8 +173,8 @@ set_volume(PN_stdfloat volume) { // Change to Miles volume, range 0 to 1.0: F32 milesVolume = volume; - milesVolume = min(milesVolume, 1.0f); - milesVolume = max(milesVolume, 0.0f); + milesVolume = std::min(milesVolume, 1.0f); + milesVolume = std::max(milesVolume, 0.0f); // Convert balance of -1.0..1.0 to 0-1.0: F32 milesBalance = (F32)((_balance + 1.0f) * 0.5f); @@ -301,7 +301,7 @@ do_set_time(PN_stdfloat time) { // Ensure we don't inadvertently run off the end of the sound. S32 length_ms; AIL_stream_ms_position(_stream, &length_ms, nullptr); - time_ms = min(time_ms, length_ms); + time_ms = std::min(time_ms, length_ms); AIL_set_stream_ms_position(_stream, time_ms); } diff --git a/panda/src/audiotraits/openalAudioManager.cxx b/panda/src/audiotraits/openalAudioManager.cxx index f6b7caa22b..feee7a62aa 100644 --- a/panda/src/audiotraits/openalAudioManager.cxx +++ b/panda/src/audiotraits/openalAudioManager.cxx @@ -33,6 +33,9 @@ #define ALC_ALL_DEVICES_SPECIFIER 0x1013 #endif +using std::endl; +using std::string; + TypeHandle OpenALAudioManager::_type_handle; ReMutex OpenALAudioManager::_lock; diff --git a/panda/src/audiotraits/openalAudioSound.cxx b/panda/src/audiotraits/openalAudioSound.cxx index 2a697a642b..8d41a61fa3 100644 --- a/panda/src/audiotraits/openalAudioSound.cxx +++ b/panda/src/audiotraits/openalAudioSound.cxx @@ -836,14 +836,14 @@ get_active() const { * */ void OpenALAudioSound:: -set_finished_event(const string& event) { +set_finished_event(const std::string& event) { _finished_event = event; } /** * */ -const string& OpenALAudioSound:: +const std::string& OpenALAudioSound:: get_finished_event() const { return _finished_event; } @@ -851,7 +851,7 @@ get_finished_event() const { /** * Get name of sound file */ -const string& OpenALAudioSound:: +const std::string& OpenALAudioSound:: get_name() const { return _basename; } diff --git a/panda/src/awesomium/AwMouseAndKeyboard.cxx b/panda/src/awesomium/AwMouseAndKeyboard.cxx index 2ee5728584..9948c0d49d 100644 --- a/panda/src/awesomium/AwMouseAndKeyboard.cxx +++ b/panda/src/awesomium/AwMouseAndKeyboard.cxx @@ -17,7 +17,7 @@ TypeHandle AwMouseAndKeyboard::_type_handle; -AwMouseAndKeyboard::AwMouseAndKeyboard(const string &name): +AwMouseAndKeyboard::AwMouseAndKeyboard(const std::string &name): DataNode(name) { _button_events_input = define_input("button_events", ButtonEventList::get_class_type()); @@ -34,7 +34,7 @@ void AwMouseAndKeyboard::do_transmit_data(DataGraphTraverser *trav, const DataNo int num_events = button_events->get_num_events(); for (int i = 0; i < num_events; i++) { const ButtonEvent &be = button_events->get_event(i); - string event_name = be._button.get_name(); + std::string event_name = be._button.get_name(); printf("Button Event! : %s with code %i and index %i ", event_name.c_str(), be._keycode, be._button.get_index()); if(be._type == ButtonEvent::T_down) printf("down"); if(be._type == ButtonEvent::T_repeat) printf("repeat"); diff --git a/panda/src/awesomium/WebBrowserTexture.cxx b/panda/src/awesomium/WebBrowserTexture.cxx index 04908f4abc..1051a33e36 100644 --- a/panda/src/awesomium/WebBrowserTexture.cxx +++ b/panda/src/awesomium/WebBrowserTexture.cxx @@ -33,7 +33,7 @@ Texture(copy) /** * This initializes a web browser texture with the given AwWebView class. */ -WebBrowserTexture::WebBrowserTexture(const string &name, AwWebView* aw_web_view): +WebBrowserTexture::WebBrowserTexture(const std::string &name, AwWebView* aw_web_view): Texture(name), _update_active(true), _flip_texture_active(false) diff --git a/panda/src/awesomium/awWebView.cxx b/panda/src/awesomium/awWebView.cxx index 5ef0b95181..ebc3a63f89 100644 --- a/panda/src/awesomium/awWebView.cxx +++ b/panda/src/awesomium/awWebView.cxx @@ -28,7 +28,7 @@ AwWebView:: void AwWebView:: -loadURL2(const string& url, const string& frameName , const string& username , const string& password ) +loadURL2(const std::string& url, const std::string& frameName , const std::string& username , const std::string& password ) { _myWebView->loadURL2(url, frameName, username, password); diff --git a/panda/src/bullet/bulletBodyNode.cxx b/panda/src/bullet/bulletBodyNode.cxx index 565cfa35a2..9c2553c892 100644 --- a/panda/src/bullet/bulletBodyNode.cxx +++ b/panda/src/bullet/bulletBodyNode.cxx @@ -150,7 +150,7 @@ safe_to_flatten_below() const { * */ void BulletBodyNode:: -do_output(ostream &out) const { +do_output(std::ostream &out) const { PandaNode::output(out); @@ -166,7 +166,7 @@ do_output(ostream &out) const { * */ void BulletBodyNode:: -output(ostream &out) const { +output(std::ostream &out) const { LightMutexHolder holder(BulletWorld::get_global_lock()); do_output(out); @@ -427,7 +427,7 @@ remove_shape(BulletShape *shape) { found = find(_shapes.begin(), _shapes.end(), ptshape); if (found == _shapes.end()) { - bullet_cat.warning() << "shape not attached" << endl; + bullet_cat.warning() << "shape not attached" << std::endl; } else { _shapes.erase(found); diff --git a/panda/src/bullet/bulletCapsuleShape.cxx b/panda/src/bullet/bulletCapsuleShape.cxx index 44fbc3e501..85171d9b46 100644 --- a/panda/src/bullet/bulletCapsuleShape.cxx +++ b/panda/src/bullet/bulletCapsuleShape.cxx @@ -35,7 +35,7 @@ BulletCapsuleShape(PN_stdfloat radius, PN_stdfloat height, BulletUpAxis up) : _shape = new btCapsuleShapeZ(radius, height); break; default: - bullet_cat.error() << "invalid up-axis:" << up << endl; + bullet_cat.error() << "invalid up-axis:" << up << std::endl; break; } @@ -65,7 +65,7 @@ BulletCapsuleShape(const BulletCapsuleShape ©) { _shape = new btCapsuleShapeZ(_radius, _height); break; default: - bullet_cat.error() << "invalid up-axis:" << _up << endl; + bullet_cat.error() << "invalid up-axis:" << _up << std::endl; break; } @@ -150,7 +150,7 @@ fillin(DatagramIterator &scan, BamReader *manager) { _shape = new btCapsuleShapeZ(_radius, _height); break; default: - bullet_cat.error() << "invalid up-axis:" << _up << endl; + bullet_cat.error() << "invalid up-axis:" << _up << std::endl; break; } diff --git a/panda/src/bullet/bulletCharacterControllerNode.cxx b/panda/src/bullet/bulletCharacterControllerNode.cxx index d65948a824..e9652de7e5 100644 --- a/panda/src/bullet/bulletCharacterControllerNode.cxx +++ b/panda/src/bullet/bulletCharacterControllerNode.cxx @@ -34,7 +34,7 @@ BulletCharacterControllerNode(BulletShape *shape, PN_stdfloat step_height, const // Get convex shape (for ghost object) if (!shape->is_convex()) { - bullet_cat.error() << "a convex shape is required!" << endl; + bullet_cat.error() << "a convex shape is required!" << std::endl; return; } diff --git a/panda/src/bullet/bulletConeShape.cxx b/panda/src/bullet/bulletConeShape.cxx index 84c1fc4157..c4c554ba2f 100644 --- a/panda/src/bullet/bulletConeShape.cxx +++ b/panda/src/bullet/bulletConeShape.cxx @@ -35,7 +35,7 @@ BulletConeShape(PN_stdfloat radius, PN_stdfloat height, BulletUpAxis up) : _shape = new btConeShapeZ((btScalar)radius, (btScalar)height); break; default: - bullet_cat.error() << "invalid up-axis:" << up << endl; + bullet_cat.error() << "invalid up-axis:" << up << std::endl; break; } @@ -65,7 +65,7 @@ BulletConeShape(const BulletConeShape ©) { _shape = new btConeShapeZ((btScalar)_radius, (btScalar)_height); break; default: - bullet_cat.error() << "invalid up-axis:" << _up << endl; + bullet_cat.error() << "invalid up-axis:" << _up << std::endl; break; } @@ -150,7 +150,7 @@ fillin(DatagramIterator &scan, BamReader *manager) { _shape = new btConeShapeZ((btScalar)_radius, (btScalar)_height); break; default: - bullet_cat.error() << "invalid up-axis:" << _up << endl; + bullet_cat.error() << "invalid up-axis:" << _up << std::endl; break; } diff --git a/panda/src/bullet/bulletCylinderShape.cxx b/panda/src/bullet/bulletCylinderShape.cxx index 6d107bff7a..976daac96e 100644 --- a/panda/src/bullet/bulletCylinderShape.cxx +++ b/panda/src/bullet/bulletCylinderShape.cxx @@ -13,6 +13,8 @@ #include "bulletCylinderShape.h" +using std::endl; + TypeHandle BulletCylinderShape::_type_handle; /** diff --git a/panda/src/bullet/bulletDebugNode.cxx b/panda/src/bullet/bulletDebugNode.cxx index 743b5163ff..ce0c044758 100644 --- a/panda/src/bullet/bulletDebugNode.cxx +++ b/panda/src/bullet/bulletDebugNode.cxx @@ -256,12 +256,12 @@ add_for_draw(CullTraverser *trav, CullTraverserData &data) { trav->_geoms_pcollector.add_level(2); { CullableObject *object = - new CullableObject(move(debug_lines), RenderState::make_empty(), trav->get_scene()->get_cs_world_transform()); + new CullableObject(std::move(debug_lines), RenderState::make_empty(), trav->get_scene()->get_cs_world_transform()); trav->get_cull_handler()->record_object(object, trav); } { CullableObject *object = - new CullableObject(move(debug_triangles), RenderState::make_empty(), trav->get_scene()->get_cs_world_transform()); + new CullableObject(std::move(debug_triangles), RenderState::make_empty(), trav->get_scene()->get_cs_world_transform()); trav->get_cull_handler()->record_object(object, trav); } } @@ -300,7 +300,7 @@ getDebugMode() const { void BulletDebugNode::DebugDraw:: reportErrorWarning(const char *warning) { - bullet_cat.error() << warning << endl; + bullet_cat.error() << warning << std::endl; } /** @@ -381,7 +381,7 @@ drawTriangle(const btVector3 &v0, const btVector3 &v1, const btVector3 &v2, cons void BulletDebugNode::DebugDraw:: drawTriangle(const btVector3 &v0, const btVector3 &v1, const btVector3 &v2, const btVector3 &n0, const btVector3 &n1, const btVector3 &n2, const btVector3 &color, btScalar alpha) { - bullet_cat.debug() << "drawTriangle(2) - not yet implemented!" << endl; + bullet_cat.debug() << "drawTriangle(2) - not yet implemented!" << std::endl; } /** @@ -402,7 +402,7 @@ drawContactPoint(const btVector3 &point, const btVector3 &normal, btScalar dista void BulletDebugNode::DebugDraw:: draw3dText(const btVector3 &location, const char *text) { - bullet_cat.debug() << "draw3dText - not yet implemented!" << endl; + bullet_cat.debug() << "draw3dText - not yet implemented!" << std::endl; } /** diff --git a/panda/src/bullet/bulletHeightfieldShape.cxx b/panda/src/bullet/bulletHeightfieldShape.cxx index 6f5f0529e3..15e8d6f75f 100644 --- a/panda/src/bullet/bulletHeightfieldShape.cxx +++ b/panda/src/bullet/bulletHeightfieldShape.cxx @@ -89,7 +89,7 @@ BulletHeightfieldShape(Texture *tex, PN_stdfloat max_height, BulletUpAxis up) : for (int row=0; row < _num_rows; row++) { for (int column=0; column < _num_cols; column++) { if (!peeker->lookup_bilinear(sample, row * step_x, column * step_y)) { - bullet_cat.error() << "Could not sample texture." << endl; + bullet_cat.error() << "Could not sample texture." << std::endl; } // Transpose _data[_num_rows * column + row] = max_height * sample.get_x(); diff --git a/panda/src/bullet/bulletMultiSphereShape.cxx b/panda/src/bullet/bulletMultiSphereShape.cxx index ffaed8bafb..52d1edc42f 100644 --- a/panda/src/bullet/bulletMultiSphereShape.cxx +++ b/panda/src/bullet/bulletMultiSphereShape.cxx @@ -23,7 +23,7 @@ TypeHandle BulletMultiSphereShape::_type_handle; BulletMultiSphereShape:: BulletMultiSphereShape(const PTA_LVecBase3 &points, const PTA_stdfloat &radii) { - int num_spheres = min(points.size(), radii.size()); + int num_spheres = std::min(points.size(), radii.size()); // Convert points btVector3 *bt_points = new btVector3[num_spheres]; diff --git a/panda/src/bullet/bulletRigidBodyNode.cxx b/panda/src/bullet/bulletRigidBodyNode.cxx index ab8c4327f9..b0d36f705e 100644 --- a/panda/src/bullet/bulletRigidBodyNode.cxx +++ b/panda/src/bullet/bulletRigidBodyNode.cxx @@ -74,7 +74,7 @@ make_copy() const { * */ void BulletRigidBodyNode:: -output(ostream &out) const { +output(std::ostream &out) const { LightMutexHolder holder(BulletWorld::get_global_lock()); BulletBodyNode::do_output(out); diff --git a/panda/src/bullet/bulletSoftBodyNode.cxx b/panda/src/bullet/bulletSoftBodyNode.cxx index 546a73f311..4664ab75c5 100644 --- a/panda/src/bullet/bulletSoftBodyNode.cxx +++ b/panda/src/bullet/bulletSoftBodyNode.cxx @@ -207,7 +207,7 @@ transform_changed() { _soft->scale(new_scale); } - _sync = move(ts); + _sync = std::move(ts); } } diff --git a/panda/src/bullet/bulletTriangleMesh.cxx b/panda/src/bullet/bulletTriangleMesh.cxx index 9286a2d010..34372e5130 100644 --- a/panda/src/bullet/bulletTriangleMesh.cxx +++ b/panda/src/bullet/bulletTriangleMesh.cxx @@ -17,6 +17,8 @@ #include "geomVertexData.h" #include "geomVertexReader.h" +using std::endl; + TypeHandle BulletTriangleMesh::_type_handle; /** @@ -237,7 +239,7 @@ add_geom(const Geom *geom, bool remove_duplicate_vertices, const TransformState CPT(GeomVertexArrayData) vertices = prim->get_vertices(); if (vertices != nullptr) { - GeomVertexReader index(move(vertices), 0); + GeomVertexReader index(std::move(vertices), 0); while (!index.is_at_end()) { _indices.push_back(index_offset + index.get_data1i()); } @@ -280,7 +282,7 @@ add_geom(const Geom *geom, bool remove_duplicate_vertices, const TransformState CPT(GeomVertexArrayData) vertices = prim->get_vertices(); if (vertices != nullptr) { - GeomVertexReader index(move(vertices), 0); + GeomVertexReader index(std::move(vertices), 0); while (!index.is_at_end()) { _indices.push_back(find_or_add_vertex(points[index.get_data1i()])); } @@ -351,7 +353,7 @@ add_array(const PTA_LVecBase3 &points, const PTA_int &indices, bool remove_dupli * */ void BulletTriangleMesh:: -output(ostream &out) const { +output(std::ostream &out) const { LightMutexHolder holder(BulletWorld::get_global_lock()); out << get_type() << ", " << _indices.size() / 3 << " triangles"; @@ -361,7 +363,7 @@ output(ostream &out) const { * */ void BulletTriangleMesh:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << get_type() << ":" << endl; const IndexedMeshArray &array = _mesh.getIndexedMeshArray(); diff --git a/panda/src/bullet/bulletTriangleMeshShape.cxx b/panda/src/bullet/bulletTriangleMeshShape.cxx index ca9f7288cc..8416c52cbc 100644 --- a/panda/src/bullet/bulletTriangleMeshShape.cxx +++ b/panda/src/bullet/bulletTriangleMeshShape.cxx @@ -46,13 +46,13 @@ BulletTriangleMeshShape(BulletTriangleMesh *mesh, bool dynamic, bool compress, b // Assert that mesh is not NULL if (!mesh) { - bullet_cat.warning() << "mesh is NULL! creating new mesh." << endl; + bullet_cat.warning() << "mesh is NULL! creating new mesh." << std::endl; mesh = new BulletTriangleMesh(); } // Assert that mesh has at least one triangle if (mesh->do_get_num_triangles() == 0) { - bullet_cat.warning() << "mesh has zero triangles! adding degenerated triangle." << endl; + bullet_cat.warning() << "mesh has zero triangles! adding degenerated triangle." << std::endl; mesh->add_triangle(LPoint3::zero(), LPoint3::zero(), LPoint3::zero()); } diff --git a/panda/src/bullet/bulletVehicle.cxx b/panda/src/bullet/bulletVehicle.cxx index 8d0f479dee..5575d6ff22 100644 --- a/panda/src/bullet/bulletVehicle.cxx +++ b/panda/src/bullet/bulletVehicle.cxx @@ -52,7 +52,7 @@ set_coordinate_system(BulletUpAxis up) { _vehicle->setCoordinateSystem(0, 2, 1); break; default: - bullet_cat.error() << "invalid up axis:" << up << endl; + bullet_cat.error() << "invalid up axis:" << up << std::endl; break; } } diff --git a/panda/src/bullet/bulletWorld.cxx b/panda/src/bullet/bulletWorld.cxx index 6827140e93..e4c395267c 100644 --- a/panda/src/bullet/bulletWorld.cxx +++ b/panda/src/bullet/bulletWorld.cxx @@ -19,7 +19,12 @@ #include "collideMask.h" #include "lightMutexHolder.h" -#define clamp(x, x_min, x_max) max(min(x, x_max), x_min) +#define clamp(x, x_min, x_max) std::max(std::min(x, x_max), x_min) + +using std::endl; +using std::istream; +using std::ostream; +using std::string; TypeHandle BulletWorld::_type_handle; diff --git a/panda/src/bullet/config_bullet.cxx b/panda/src/bullet/config_bullet.cxx index 4e228427b9..5997bf575b 100644 --- a/panda/src/bullet/config_bullet.cxx +++ b/panda/src/bullet/config_bullet.cxx @@ -207,7 +207,7 @@ init_libbullet() { // Initialize notification category bullet_cat.init(); - bullet_cat.debug() << "initialize module" << endl; + bullet_cat.debug() << "initialize module" << std::endl; // Register the Bullet system PandaSystem *ps = PandaSystem::get_global_ptr(); diff --git a/panda/src/chan/animBundle.cxx b/panda/src/chan/animBundle.cxx index 312483b3be..8313516485 100644 --- a/panda/src/chan/animBundle.cxx +++ b/panda/src/chan/animBundle.cxx @@ -51,7 +51,7 @@ copy_bundle() const { * Writes a one-line description of the bundle. */ void AnimBundle:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type() << " " << get_name() << ", " << get_num_frames() << " frames at " << get_base_frame_rate() << " fps"; } diff --git a/panda/src/chan/animChannel.cxx b/panda/src/chan/animChannel.cxx index dfaf152b7b..d34d364068 100644 --- a/panda/src/chan/animChannel.cxx +++ b/panda/src/chan/animChannel.cxx @@ -22,7 +22,7 @@ template class AnimChannel; * Outputs a very brief description of a matrix. */ void ACMatrixSwitchType:: -output_value(ostream &out, const ACMatrixSwitchType::ValueType &value) { +output_value(std::ostream &out, const ACMatrixSwitchType::ValueType &value) { LVecBase3 scale, shear, hpr, translate; if (decompose_matrix(value, scale, shear, hpr, translate)) { if (!scale.almost_equal(LVecBase3(1.0f, 1.0f, 1.0f))) { diff --git a/panda/src/chan/animChannelMatrixDynamic.cxx b/panda/src/chan/animChannelMatrixDynamic.cxx index 1fa762e782..53b2771685 100644 --- a/panda/src/chan/animChannelMatrixDynamic.cxx +++ b/panda/src/chan/animChannelMatrixDynamic.cxx @@ -49,7 +49,7 @@ AnimChannelMatrixDynamic(AnimGroup *parent, const AnimChannelMatrixDynamic © * */ AnimChannelMatrixDynamic:: -AnimChannelMatrixDynamic(const string &name) +AnimChannelMatrixDynamic(const std::string &name) : AnimChannelMatrix(name) { _value = TransformState::make_identity(); diff --git a/panda/src/chan/animChannelMatrixFixed.cxx b/panda/src/chan/animChannelMatrixFixed.cxx index cf79e7ea5a..d5f0ef3d84 100644 --- a/panda/src/chan/animChannelMatrixFixed.cxx +++ b/panda/src/chan/animChannelMatrixFixed.cxx @@ -34,7 +34,7 @@ AnimChannelMatrixFixed(AnimGroup *parent, const AnimChannelMatrixFixed ©) : * */ AnimChannelMatrixFixed:: -AnimChannelMatrixFixed(const string &name, const LVecBase3 &pos, const LVecBase3 &hpr, const LVecBase3 &scale) : +AnimChannelMatrixFixed(const std::string &name, const LVecBase3 &pos, const LVecBase3 &hpr, const LVecBase3 &scale) : AnimChannel(name), _pos(pos), _hpr(hpr), _scale(scale) { @@ -116,7 +116,7 @@ get_shear(int, LVecBase3 &shear) { * */ void AnimChannelMatrixFixed:: -output(ostream &out) const { +output(std::ostream &out) const { AnimChannel::output(out); out << ": pos " << _pos << " hpr " << _hpr << " scale " << _scale; } diff --git a/panda/src/chan/animChannelMatrixXfmTable.cxx b/panda/src/chan/animChannelMatrixXfmTable.cxx index ec9564ee88..c6c27b8b7a 100644 --- a/panda/src/chan/animChannelMatrixXfmTable.cxx +++ b/panda/src/chan/animChannelMatrixXfmTable.cxx @@ -54,7 +54,7 @@ AnimChannelMatrixXfmTable(AnimGroup *parent, const AnimChannelMatrixXfmTable &co * */ AnimChannelMatrixXfmTable:: -AnimChannelMatrixXfmTable(AnimGroup *parent, const string &name) +AnimChannelMatrixXfmTable(AnimGroup *parent, const std::string &name) : AnimChannelMatrix(parent, name) { for (int i = 0; i < num_matrix_components; i++) { @@ -267,7 +267,7 @@ clear_all_tables() { * Writes a brief description of the table and all of its descendants. */ void AnimChannelMatrixXfmTable:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << get_type() << " " << get_name() << " "; @@ -369,7 +369,7 @@ write_datagram(BamWriter *manager, Datagram &me) { // Now, write out the joint angles. For these we need to build up a HPR // array. pvector hprs; - int hprs_length = max(max(_tables[6].size(), _tables[7].size()), _tables[8].size()); + int hprs_length = std::max(std::max(_tables[6].size(), _tables[7].size()), _tables[8].size()); hprs.reserve(hprs_length); for (i = 0; i < hprs_length; i++) { PN_stdfloat h = _tables[6].empty() ? 0.0f : _tables[6][i % _tables[6].size()]; @@ -419,7 +419,7 @@ fillin(DatagramIterator &scan, BamReader *manager) { if (!new_hpr) { // Convert between the old HPR form and the new HPR form. - size_t num_hprs = max(max(_tables[6].size(), _tables[7].size()), + size_t num_hprs = std::max(std::max(_tables[6].size(), _tables[7].size()), _tables[8].size()); LVecBase3 default_hpr(0.0, 0.0, 0.0); diff --git a/panda/src/chan/animChannelScalarDynamic.cxx b/panda/src/chan/animChannelScalarDynamic.cxx index a5597110ba..8a9835a550 100644 --- a/panda/src/chan/animChannelScalarDynamic.cxx +++ b/panda/src/chan/animChannelScalarDynamic.cxx @@ -51,7 +51,7 @@ AnimChannelScalarDynamic(AnimGroup *parent, const AnimChannelScalarDynamic © * */ AnimChannelScalarDynamic:: -AnimChannelScalarDynamic(const string &name) +AnimChannelScalarDynamic(const std::string &name) : AnimChannelScalar(name) { _last_value = _value = TransformState::make_identity(); diff --git a/panda/src/chan/animChannelScalarTable.cxx b/panda/src/chan/animChannelScalarTable.cxx index 195258b9c7..54953164e7 100644 --- a/panda/src/chan/animChannelScalarTable.cxx +++ b/panda/src/chan/animChannelScalarTable.cxx @@ -47,7 +47,7 @@ AnimChannelScalarTable(AnimGroup *parent, const AnimChannelScalarTable ©) : * */ AnimChannelScalarTable:: -AnimChannelScalarTable(AnimGroup *parent, const string &name) : +AnimChannelScalarTable(AnimGroup *parent, const std::string &name) : AnimChannelScalar(parent, name), _table(get_class_type()) { @@ -115,7 +115,7 @@ set_table(const CPTA_stdfloat &table) { * Writes a brief description of the table and all of its descendants. */ void AnimChannelScalarTable:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << get_type() << " " << get_name() << " " << _table.size(); diff --git a/panda/src/chan/animControl.cxx b/panda/src/chan/animControl.cxx index 34fd94646e..aa47ea7486 100644 --- a/panda/src/chan/animControl.cxx +++ b/panda/src/chan/animControl.cxx @@ -27,7 +27,7 @@ TypeHandle AnimControl::_type_handle; * being loaded during an asynchronous load-and-bind operation. */ AnimControl:: -AnimControl(const string &name, PartBundle *part, +AnimControl(const std::string &name, PartBundle *part, double frame_rate, int num_frames) : Namable(name), _pending_lock(name), @@ -131,7 +131,7 @@ wait_pending() { * binding, the event will be thrown immediately. */ void AnimControl:: -set_pending_done_event(const string &done_event) { +set_pending_done_event(const std::string &done_event) { MutexHolder holder(_pending_lock); _pending_done_event = done_event; if (!_pending) { @@ -143,7 +143,7 @@ set_pending_done_event(const string &done_event) { * Returns the event name that will be thrown when the AnimControl is finished * binding asynchronously. */ -string AnimControl:: +std::string AnimControl:: get_pending_done_event() const { MutexHolder holder(_pending_lock); return _pending_done_event; @@ -161,7 +161,7 @@ get_part() const { * */ void AnimControl:: -output(ostream &out) const { +output(std::ostream &out) const { out << "AnimControl(" << get_name() << ", " << get_part()->get_name() << ": "; AnimInterface::output(out); diff --git a/panda/src/chan/animControlCollection.cxx b/panda/src/chan/animControlCollection.cxx index 50783b5305..f8e6ed7b17 100644 --- a/panda/src/chan/animControlCollection.cxx +++ b/panda/src/chan/animControlCollection.cxx @@ -13,6 +13,8 @@ #include "animControlCollection.h" +using std::string; + /** * Returns the AnimControl associated with the given name, or NULL if no such @@ -252,7 +254,7 @@ which_anim_playing() const { * */ void AnimControlCollection:: -output(ostream &out) const { +output(std::ostream &out) const { out << _controls.size() << " anims."; } @@ -260,7 +262,7 @@ output(ostream &out) const { * */ void AnimControlCollection:: -write(ostream &out) const { +write(std::ostream &out) const { ControlsByName::const_iterator ci; for (ci = _controls_by_name.begin(); ci != _controls_by_name.end(); diff --git a/panda/src/chan/animGroup.cxx b/panda/src/chan/animGroup.cxx index 4c23b36110..17a83f1f20 100644 --- a/panda/src/chan/animGroup.cxx +++ b/panda/src/chan/animGroup.cxx @@ -24,6 +24,8 @@ #include +using std::string; + TypeHandle AnimGroup::_type_handle; @@ -179,7 +181,7 @@ get_value_type() const { * Writes a one-line description of the group. */ void AnimGroup:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type() << " " << get_name(); } @@ -187,7 +189,7 @@ output(ostream &out) const { * Writes a brief description of the group and all of its descendants. */ void AnimGroup:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << *this; if (!_children.empty()) { out << " {\n"; @@ -201,7 +203,7 @@ write(ostream &out, int indent_level) const { * Writes a brief description of all of the group's descendants. */ void AnimGroup:: -write_descendants(ostream &out, int indent_level) const { +write_descendants(std::ostream &out, int indent_level) const { Children::const_iterator ci; for (ci = _children.begin(); ci != _children.end(); ++ci) { @@ -277,7 +279,7 @@ complete_pointers(TypedWritable **p_list, BamReader *) { for (int i = 1; i < _num_children+1; i++) { if (p_list[i] == TypedWritable::Null) { chan_cat->warning() << get_type().get_name() - << " Ignoring null child" << endl; + << " Ignoring null child" << std::endl; } else { _children.push_back(DCAST(AnimGroup, p_list[i])); } diff --git a/panda/src/chan/animPreloadTable.cxx b/panda/src/chan/animPreloadTable.cxx index 9303c11490..43958482b3 100644 --- a/panda/src/chan/animPreloadTable.cxx +++ b/panda/src/chan/animPreloadTable.cxx @@ -60,7 +60,7 @@ get_num_anims() const { * Filename::get_basename_wo_extension(). */ int AnimPreloadTable:: -find_anim(const string &basename) const { +find_anim(const std::string &basename) const { consider_sort(); AnimRecord record; record._basename = basename; @@ -96,7 +96,7 @@ remove_anim(int n) { * See find_anim(). This will invalidate existing index numbers. */ void AnimPreloadTable:: -add_anim(const string &basename, PN_stdfloat base_frame_rate, int num_frames) { +add_anim(const std::string &basename, PN_stdfloat base_frame_rate, int num_frames) { AnimRecord record; record._basename = basename; record._base_frame_rate = base_frame_rate; @@ -124,7 +124,7 @@ add_anims_from(const AnimPreloadTable *other) { * */ void AnimPreloadTable:: -output(ostream &out) const { +output(std::ostream &out) const { consider_sort(); out << "AnimPreloadTable, " << _anims.size() << " animation records."; } @@ -133,7 +133,7 @@ output(ostream &out) const { * */ void AnimPreloadTable:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { consider_sort(); indent(out, indent_level) << "AnimPreloadTable, " << _anims.size() << " animation records:\n"; diff --git a/panda/src/chan/auto_bind.cxx b/panda/src/chan/auto_bind.cxx index e9e827b319..993201a8ef 100644 --- a/panda/src/chan/auto_bind.cxx +++ b/panda/src/chan/auto_bind.cxx @@ -18,6 +18,8 @@ #include "string_utils.h" #include "partGroup.h" +using std::string; + typedef pset AnimBundles; typedef pmap Anims; diff --git a/panda/src/chan/bindAnimRequest.cxx b/panda/src/chan/bindAnimRequest.cxx index c1b34038ff..637f44831d 100644 --- a/panda/src/chan/bindAnimRequest.cxx +++ b/panda/src/chan/bindAnimRequest.cxx @@ -22,7 +22,7 @@ TypeHandle BindAnimRequest::_type_handle; * */ BindAnimRequest:: -BindAnimRequest(const string &name, +BindAnimRequest(const std::string &name, const Filename &filename, const LoaderOptions &options, Loader *loader, AnimControl *control, int hierarchy_match_flags, diff --git a/panda/src/chan/movingPartBase.cxx b/panda/src/chan/movingPartBase.cxx index cc60dabe3c..e4016edd2c 100644 --- a/panda/src/chan/movingPartBase.cxx +++ b/panda/src/chan/movingPartBase.cxx @@ -26,7 +26,7 @@ TypeHandle MovingPartBase::_type_handle; * */ MovingPartBase:: -MovingPartBase(PartGroup *parent, const string &name) : +MovingPartBase(PartGroup *parent, const std::string &name) : PartGroup(parent, name), _num_effective_channels(0), _effective_control(nullptr) @@ -70,7 +70,7 @@ get_forced_channel() const { * Writes a brief description of the channel and all of its descendants. */ void MovingPartBase:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << get_value_type() << " " << get_name(); if (_children.empty()) { out << "\n"; @@ -86,7 +86,7 @@ write(ostream &out, int indent_level) const { * with their values. */ void MovingPartBase:: -write_with_value(ostream &out, int indent_level) const { +write_with_value(std::ostream &out, int indent_level) const { indent(out, indent_level) << get_value_type() << " " << get_name() << "\n"; indent(out, indent_level); output_value(out); diff --git a/panda/src/chan/partBundle.cxx b/panda/src/chan/partBundle.cxx index d2aa343774..dffed55d50 100644 --- a/panda/src/chan/partBundle.cxx +++ b/panda/src/chan/partBundle.cxx @@ -31,6 +31,10 @@ #include +using std::istream; +using std::ostream; +using std::string; + TypeHandle PartBundle::_type_handle; diff --git a/panda/src/chan/partGroup.cxx b/panda/src/chan/partGroup.cxx index ad501ca24c..52cee4ce19 100644 --- a/panda/src/chan/partGroup.cxx +++ b/panda/src/chan/partGroup.cxx @@ -25,6 +25,8 @@ #include +using std::ostream; + TypeHandle PartGroup::_type_handle; /** @@ -32,7 +34,7 @@ TypeHandle PartGroup::_type_handle; * to delete it subsequently is to delete the entire hierarchy. */ PartGroup:: -PartGroup(PartGroup *parent, const string &name) : +PartGroup(PartGroup *parent, const std::string &name) : Namable(name), _children(get_class_type()) { @@ -113,7 +115,7 @@ get_child(int n) const { * find_child(). */ PartGroup *PartGroup:: -get_child_named(const string &name) const { +get_child_named(const std::string &name) const { Children::const_iterator ci; for (ci = _children.begin(); ci != _children.end(); ++ci) { PartGroup *child = (*ci); @@ -131,7 +133,7 @@ get_child_named(const string &name) const { * this PartGroup; see also get_child_named(). */ PartGroup *PartGroup:: -find_child(const string &name) const { +find_child(const std::string &name) const { Children::const_iterator ci; for (ci = _children.begin(); ci != _children.end(); ++ci) { PartGroup *child = (*ci); diff --git a/panda/src/chan/partSubset.cxx b/panda/src/chan/partSubset.cxx index 6e88cce020..5e2a6c5831 100644 --- a/panda/src/chan/partSubset.cxx +++ b/panda/src/chan/partSubset.cxx @@ -89,7 +89,7 @@ append(const PartSubset &other) { * */ void PartSubset:: -output(ostream &out) const { +output(std::ostream &out) const { if (_include_joints.empty() && _exclude_joints.empty()) { out << "PartSubset, empty"; } else { @@ -120,7 +120,7 @@ is_include_empty() const { * false otherwise. */ bool PartSubset:: -matches_include(const string &joint_name) const { +matches_include(const std::string &joint_name) const { Joints::const_iterator ji; for (ji = _include_joints.begin(); ji != _include_joints.end(); ++ji) { if ((*ji).matches(joint_name)) { @@ -137,7 +137,7 @@ matches_include(const string &joint_name) const { * false otherwise. */ bool PartSubset:: -matches_exclude(const string &joint_name) const { +matches_exclude(const std::string &joint_name) const { Joints::const_iterator ji; for (ji = _exclude_joints.begin(); ji != _exclude_joints.end(); ++ji) { if ((*ji).matches(joint_name)) { diff --git a/panda/src/char/character.cxx b/panda/src/char/character.cxx index 8b5bac116a..0e2655de54 100644 --- a/panda/src/char/character.cxx +++ b/panda/src/char/character.cxx @@ -73,7 +73,7 @@ Character(const Character ©, bool copy_bundles) : * */ Character:: -Character(const string &name) : +Character(const std::string &name) : PartBundleNode(name, new CharacterJointBundle(name)), _joints_pcollector(PStatCollector(_animation_pcollector, name), "Joints"), _skinning_pcollector(PStatCollector(_animation_pcollector, name), "Vertices") @@ -355,7 +355,7 @@ clear_lod_animation() { * to a slider. */ CharacterJoint *Character:: -find_joint(const string &name) const { +find_joint(const std::string &name) const { int num_bundles = get_num_bundles(); for (int i = 0; i < num_bundles; ++i) { PartGroup *part = get_bundle(i)->find_child(name); @@ -373,7 +373,7 @@ find_joint(const string &name) const { * to a joint. */ CharacterSlider *Character:: -find_slider(const string &name) const { +find_slider(const std::string &name) const { int num_bundles = get_num_bundles(); for (int i = 0; i < num_bundles; ++i) { PartGroup *part = get_bundle(i)->find_child(name); @@ -391,7 +391,7 @@ find_slider(const string &name) const { * structure, to the indicated output stream. */ void Character:: -write_parts(ostream &out) const { +write_parts(std::ostream &out) const { int num_bundles = get_num_bundles(); for (int i = 0; i < num_bundles; ++i) { get_bundle(i)->write(out, 0); @@ -404,7 +404,7 @@ write_parts(ostream &out) const { * stream. */ void Character:: -write_part_values(ostream &out) const { +write_part_values(std::ostream &out) const { int num_bundles = get_num_bundles(); for (int i = 0; i < num_bundles; ++i) { get_bundle(i)->write_with_value(out, 0); @@ -671,7 +671,7 @@ r_merge_bundles(Character::JointMap &joint_map, int new_num_children = new_group->get_num_children(); PartGroup::Children new_children(PartGroup::get_class_type()); - new_children.reserve(max(old_num_children, new_num_children)); + new_children.reserve(std::max(old_num_children, new_num_children)); while (i < old_num_children && j < new_num_children) { PartGroup *pc = old_group->get_child(i); diff --git a/panda/src/char/characterJoint.cxx b/panda/src/char/characterJoint.cxx index 8a424d91c1..7e3e1c9b9a 100644 --- a/panda/src/char/characterJoint.cxx +++ b/panda/src/char/characterJoint.cxx @@ -50,7 +50,7 @@ CharacterJoint(const CharacterJoint ©) : */ CharacterJoint:: CharacterJoint(Character *character, - PartBundle *root, PartGroup *parent, const string &name, + PartBundle *root, PartGroup *parent, const std::string &name, const LMatrix4 &default_value) : MovingPartMatrix(parent, name, default_value), _character(character) diff --git a/panda/src/char/characterJointBundle.cxx b/panda/src/char/characterJointBundle.cxx index 980e9058dc..86a43f7e13 100644 --- a/panda/src/char/characterJointBundle.cxx +++ b/panda/src/char/characterJointBundle.cxx @@ -24,7 +24,7 @@ TypeHandle CharacterJointBundle::_type_handle; * Character node will automatically create one for itself. */ CharacterJointBundle:: -CharacterJointBundle(const string &name) : PartBundle(name) { +CharacterJointBundle(const std::string &name) : PartBundle(name) { } /** diff --git a/panda/src/char/characterJointEffect.cxx b/panda/src/char/characterJointEffect.cxx index 50b1a878e8..b4bc263c20 100644 --- a/panda/src/char/characterJointEffect.cxx +++ b/panda/src/char/characterJointEffect.cxx @@ -87,7 +87,7 @@ safe_to_combine() const { * */ void CharacterJointEffect:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type(); PT(Character) character = get_character(); if (character != nullptr) { diff --git a/panda/src/char/characterSlider.cxx b/panda/src/char/characterSlider.cxx index 824b7e2737..b4ced5e782 100644 --- a/panda/src/char/characterSlider.cxx +++ b/panda/src/char/characterSlider.cxx @@ -40,7 +40,7 @@ CharacterSlider(const CharacterSlider ©) : * */ CharacterSlider:: -CharacterSlider(PartGroup *parent, const string &name) +CharacterSlider(PartGroup *parent, const std::string &name) : MovingPartScalar(parent, name) { } diff --git a/panda/src/char/jointVertexTransform.cxx b/panda/src/char/jointVertexTransform.cxx index 5212aa6cd9..5f60777ff1 100644 --- a/panda/src/char/jointVertexTransform.cxx +++ b/panda/src/char/jointVertexTransform.cxx @@ -83,7 +83,7 @@ accumulate_matrix(LMatrix4 &accum, PN_stdfloat weight) const { * */ void JointVertexTransform:: -output(ostream &out) const { +output(std::ostream &out) const { out << _joint->get_name(); } diff --git a/panda/src/cocoadisplay/cocoaGraphicsBuffer.mm b/panda/src/cocoadisplay/cocoaGraphicsBuffer.mm index 07f44b6c94..f45837ed87 100644 --- a/panda/src/cocoadisplay/cocoaGraphicsBuffer.mm +++ b/panda/src/cocoadisplay/cocoaGraphicsBuffer.mm @@ -25,7 +25,7 @@ TypeHandle CocoaGraphicsBuffer::_type_handle; */ CocoaGraphicsBuffer:: CocoaGraphicsBuffer(GraphicsEngine *engine, GraphicsPipe *pipe, - const string &name, + const std::string &name, const FrameBufferProperties &fb_prop, const WindowProperties &win_prop, int flags, diff --git a/panda/src/cocoadisplay/cocoaGraphicsPipe.mm b/panda/src/cocoadisplay/cocoaGraphicsPipe.mm index dd554e2a77..91bd0fbbb9 100644 --- a/panda/src/cocoadisplay/cocoaGraphicsPipe.mm +++ b/panda/src/cocoadisplay/cocoaGraphicsPipe.mm @@ -169,7 +169,7 @@ CocoaGraphicsPipe:: * choose between several possible GraphicsPipes available on a particular * platform, so the name should be meaningful and unique for a given platform. */ -string CocoaGraphicsPipe:: +std::string CocoaGraphicsPipe:: get_interface_name() const { return "OpenGL"; } @@ -199,7 +199,7 @@ CocoaGraphicsPipe::get_preferred_window_thread() const { * Creates a new window on the pipe, if possible. */ PT(GraphicsOutput) CocoaGraphicsPipe:: -make_output(const string &name, +make_output(const std::string &name, const FrameBufferProperties &fb_prop, const WindowProperties &win_prop, int flags, diff --git a/panda/src/cocoadisplay/cocoaGraphicsStateGuardian.mm b/panda/src/cocoadisplay/cocoaGraphicsStateGuardian.mm index ec25b94486..26d4dbdf71 100644 --- a/panda/src/cocoadisplay/cocoaGraphicsStateGuardian.mm +++ b/panda/src/cocoadisplay/cocoaGraphicsStateGuardian.mm @@ -190,7 +190,7 @@ choose_pixel_format(const FrameBufferProperties &properties, // make it grab one with 8 bits, though. Dirty hack. Needs more research. if (properties.get_alpha_bits() > 0) { attribs.push_back(NSOpenGLPFAAlphaSize); - attribs.push_back(max(8, properties.get_alpha_bits())); + attribs.push_back(std::max(8, properties.get_alpha_bits())); } if (properties.get_multisamples() > 0) { diff --git a/panda/src/cocoadisplay/cocoaGraphicsWindow.mm b/panda/src/cocoadisplay/cocoaGraphicsWindow.mm index df12a69985..7d461817f1 100644 --- a/panda/src/cocoadisplay/cocoaGraphicsWindow.mm +++ b/panda/src/cocoadisplay/cocoaGraphicsWindow.mm @@ -50,7 +50,7 @@ TypeHandle CocoaGraphicsWindow::_type_handle; */ CocoaGraphicsWindow:: CocoaGraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe, - const string &name, + const std::string &name, const FrameBufferProperties &fb_prop, const WindowProperties &win_prop, int flags, @@ -1293,7 +1293,7 @@ load_image(const Filename &filename) { if (vfile == NULL) { return nil; } - istream *str = vfile->open_read_file(true); + std::istream *str = vfile->open_read_file(true); if (str == NULL) { cocoadisplay_cat.error() << "Could not open file " << filename << " for reading\n"; @@ -1449,7 +1449,7 @@ handle_foreground_event(bool foreground) { */ bool CocoaGraphicsWindow:: handle_close_request() { - string close_request_event = get_close_request_event(); + std::string close_request_event = get_close_request_event(); if (!close_request_event.empty()) { // In this case, the app has indicated a desire to intercept the request // and process it directly. diff --git a/panda/src/collada/colladaBindMaterial.cxx b/panda/src/collada/colladaBindMaterial.cxx index 2ef46e4a99..90ea8a21cf 100644 --- a/panda/src/collada/colladaBindMaterial.cxx +++ b/panda/src/collada/colladaBindMaterial.cxx @@ -48,7 +48,7 @@ get_material(const ColladaPrimitive *prim) const { * found. */ CPT(RenderState) ColladaBindMaterial:: -get_material(const string &symbol) const { +get_material(const std::string &symbol) const { if (_states.count(symbol) == 0) { return nullptr; } diff --git a/panda/src/collada/colladaInput.cxx b/panda/src/collada/colladaInput.cxx index be6522b23f..09ce788655 100644 --- a/panda/src/collada/colladaInput.cxx +++ b/panda/src/collada/colladaInput.cxx @@ -37,7 +37,7 @@ * Pretty obvious what this does. */ ColladaInput:: -ColladaInput(const string &semantic) : +ColladaInput(const std::string &semantic) : _column_name (nullptr), _semantic (semantic), _offset (0), @@ -69,14 +69,14 @@ ColladaInput(const string &semantic) : * Pretty obvious what this does. */ ColladaInput:: -ColladaInput(const string &semantic, unsigned int set) : +ColladaInput(const std::string &semantic, unsigned int set) : _column_name (nullptr), _semantic (semantic), _offset (0), _have_set (true), _set (set) { - ostringstream setstr; + std::ostringstream setstr; setstr << _set; if (semantic == "POSITION") { diff --git a/panda/src/collada/colladaLoader.cxx b/panda/src/collada/colladaLoader.cxx index 7414af0a7f..1347d492a1 100644 --- a/panda/src/collada/colladaLoader.cxx +++ b/panda/src/collada/colladaLoader.cxx @@ -76,7 +76,7 @@ bool ColladaLoader:: read(const Filename &filename) { _filename = filename; - string data; + std::string data; VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr(); if (!vfs->read_file(_filename, data, true)) { @@ -299,7 +299,7 @@ load_tags(domExtra &extra, PandaNode *node) { daeElement &child = *children[c]; if (cmp_nocase(child.getElementName(), "tag") == 0) { - const string &name = child.getAttribute("name"); + const std::string &name = child.getAttribute("name"); if (name.size() > 0) { node->set_tag(name, child.getCharData()); } else { diff --git a/panda/src/collada/loaderFileTypeDae.cxx b/panda/src/collada/loaderFileTypeDae.cxx index 9fc5785514..a35223f30c 100644 --- a/panda/src/collada/loaderFileTypeDae.cxx +++ b/panda/src/collada/loaderFileTypeDae.cxx @@ -26,7 +26,7 @@ LoaderFileTypeDae() { /** * */ -string LoaderFileTypeDae:: +std::string LoaderFileTypeDae:: get_name() const { #if PANDA_COLLADA_VERSION == 14 return "COLLADA 1.4"; @@ -40,7 +40,7 @@ get_name() const { /** * */ -string LoaderFileTypeDae:: +std::string LoaderFileTypeDae:: get_extension() const { return "dae"; } @@ -49,7 +49,7 @@ get_extension() const { * Returns a space-separated list of extension, in addition to the one * returned by get_extension(), that are recognized by this loader. */ -string LoaderFileTypeDae:: +std::string LoaderFileTypeDae:: get_additional_extensions() const { return "zae"; } diff --git a/panda/src/collide/collisionBox.cxx b/panda/src/collide/collisionBox.cxx index ad025f8682..46666722e2 100644 --- a/panda/src/collide/collisionBox.cxx +++ b/panda/src/collide/collisionBox.cxx @@ -35,6 +35,9 @@ #include +using std::max; +using std::min; + PStatCollector CollisionBox::_volume_pcollector("Collision Volumes:CollisionBox"); PStatCollector CollisionBox::_test_pcollector("Collision Tests:CollisionBox"); TypeHandle CollisionBox::_type_handle; @@ -181,7 +184,7 @@ get_test_pcollector() { * */ void CollisionBox:: -output(ostream &out) const { +output(std::ostream &out) const { } /** diff --git a/panda/src/collide/collisionEntry.cxx b/panda/src/collide/collisionEntry.cxx index 237c725579..2a8c97fa2c 100644 --- a/panda/src/collide/collisionEntry.cxx +++ b/panda/src/collide/collisionEntry.cxx @@ -209,7 +209,7 @@ get_all_contact_info(const NodePath &space, LPoint3 &contact_pos, * */ void CollisionEntry:: -output(ostream &out) const { +output(std::ostream &out) const { out << _from_node_path; if (!_into_node_path.is_empty()) { out << " into " << _into_node_path; @@ -223,7 +223,7 @@ output(ostream &out) const { * */ void CollisionEntry:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << "CollisionEntry:\n"; if (!_from_node_path.is_empty()) { diff --git a/panda/src/collide/collisionFloorMesh.cxx b/panda/src/collide/collisionFloorMesh.cxx index fa7ac93949..5f0ab0cabc 100644 --- a/panda/src/collide/collisionFloorMesh.cxx +++ b/panda/src/collide/collisionFloorMesh.cxx @@ -33,6 +33,10 @@ #include "geomLinestrips.h" #include "geomVertexWriter.h" #include + +using std::max; +using std::min; + PStatCollector CollisionFloorMesh::_volume_pcollector("Collision Volumes:CollisionFloorMesh"); PStatCollector CollisionFloorMesh::_test_pcollector("Collision Tests:CollisionFloorMesh"); TypeHandle CollisionFloorMesh::_type_handle; @@ -86,7 +90,7 @@ get_collision_origin() const { * */ void CollisionFloorMesh:: -output(ostream &out) const { +output(std::ostream &out) const { out << "cfloor"; } @@ -406,7 +410,7 @@ register_with_read_factory() { * */ void CollisionFloorMesh:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << (*this) << "\n"; } diff --git a/panda/src/collide/collisionGeom.cxx b/panda/src/collide/collisionGeom.cxx index 15211b9598..b90bebe38b 100644 --- a/panda/src/collide/collisionGeom.cxx +++ b/panda/src/collide/collisionGeom.cxx @@ -47,6 +47,6 @@ get_test_pcollector() { * */ void CollisionGeom:: -output(ostream &out) const { +output(std::ostream &out) const { out << "cgeom"; } diff --git a/panda/src/collide/collisionHandlerEvent.cxx b/panda/src/collide/collisionHandlerEvent.cxx index 872044bb22..0fd949074e 100644 --- a/panda/src/collide/collisionHandlerEvent.cxx +++ b/panda/src/collide/collisionHandlerEvent.cxx @@ -17,6 +17,8 @@ #include "eventParameter.h" #include "throw_event.h" +using std::string; + TypeHandle CollisionHandlerEvent::_type_handle; diff --git a/panda/src/collide/collisionHandlerFloor.cxx b/panda/src/collide/collisionHandlerFloor.cxx index 3c8c8e80bf..506101cb41 100644 --- a/panda/src/collide/collisionHandlerFloor.cxx +++ b/panda/src/collide/collisionHandlerFloor.cxx @@ -18,6 +18,9 @@ #include "clockObject.h" +using std::cout; +using std::endl; + TypeHandle CollisionHandlerFloor::_type_handle; /** @@ -204,7 +207,7 @@ handle_entries() { if (adjust < 0.0f && _max_velocity != 0.0f) { PN_stdfloat max_adjust = _max_velocity * ClockObject::get_global_clock()->get_dt(); - adjust = max(adjust, -max_adjust); + adjust = std::max(adjust, -max_adjust); } CPT(TransformState) trans = def._target.get_transform(); diff --git a/panda/src/collide/collisionHandlerGravity.cxx b/panda/src/collide/collisionHandlerGravity.cxx index 42a52a54b6..023d220cd4 100644 --- a/panda/src/collide/collisionHandlerGravity.cxx +++ b/panda/src/collide/collisionHandlerGravity.cxx @@ -18,6 +18,9 @@ #include "collisionPlane.h" #include "clockObject.h" +using std::cout; +using std::endl; + TypeHandle CollisionHandlerGravity::_type_handle; /** @@ -254,10 +257,10 @@ handle_entries() { // ...the node is under the floor, so it has landed. Keep the // adjust to bring us up to the ground and then add the // gravity_adjust to get us airborne: - adjust += max((PN_stdfloat)0.0, gravity_adjust); + adjust += std::max((PN_stdfloat)0.0, gravity_adjust); } else { // ...the node is above the floor, so it is airborne. - adjust = max(adjust, gravity_adjust); + adjust = std::max(adjust, gravity_adjust); } _current_velocity -= _gravity * dt; // Record the airborne height in case someone else needs it: diff --git a/panda/src/collide/collisionHandlerQueue.cxx b/panda/src/collide/collisionHandlerQueue.cxx index 7a2fefd271..75761362bd 100644 --- a/panda/src/collide/collisionHandlerQueue.cxx +++ b/panda/src/collide/collisionHandlerQueue.cxx @@ -126,7 +126,7 @@ get_entry(int n) const { * */ void CollisionHandlerQueue:: -output(ostream &out) const { +output(std::ostream &out) const { out << "CollisionHandlerQueue, " << _entries.size() << " entries"; } @@ -134,7 +134,7 @@ output(ostream &out) const { * */ void CollisionHandlerQueue:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << "CollisionHandlerQueue, " << _entries.size() << " entries:\n"; diff --git a/panda/src/collide/collisionInvSphere.cxx b/panda/src/collide/collisionInvSphere.cxx index 2074fb9522..8a75135e55 100644 --- a/panda/src/collide/collisionInvSphere.cxx +++ b/panda/src/collide/collisionInvSphere.cxx @@ -72,7 +72,7 @@ get_test_pcollector() { * */ void CollisionInvSphere:: -output(ostream &out) const { +output(std::ostream &out) const { out << "invsphere, c (" << get_center() << "), r " << get_radius(); } @@ -198,7 +198,7 @@ test_intersection_from_ray(const CollisionEntry &entry) const { t1 = t2 = 0.0; } - t2 = max(t2, 0.0); + t2 = std::max(t2, 0.0); if (collide_cat.is_debug()) { collide_cat.debug() @@ -254,11 +254,11 @@ test_intersection_from_segment(const CollisionEntry &entry) const { } else if (t2 <= 1.0) { // The bottom edge of the segment intersects the shell. - t = min(t2, 1.0); + t = std::min(t2, 1.0); } else if (t1 >= 0.0) { // The top edge of the segment intersects the shell. - t = max(t1, 0.0); + t = std::max(t1, 0.0); } else { // Neither edge of the segment intersects the shell. It follows that both diff --git a/panda/src/collide/collisionLine.cxx b/panda/src/collide/collisionLine.cxx index 5e98087145..27b066b3c9 100644 --- a/panda/src/collide/collisionLine.cxx +++ b/panda/src/collide/collisionLine.cxx @@ -51,7 +51,7 @@ test_intersection(const CollisionEntry &entry) const { * */ void CollisionLine:: -output(ostream &out) const { +output(std::ostream &out) const { out << "line, o (" << get_origin() << "), d (" << get_direction() << ")"; } diff --git a/panda/src/collide/collisionNode.cxx b/panda/src/collide/collisionNode.cxx index 803a5f058d..ce037f917f 100644 --- a/panda/src/collide/collisionNode.cxx +++ b/panda/src/collide/collisionNode.cxx @@ -37,7 +37,7 @@ TypeHandle CollisionNode::_type_handle; * */ CollisionNode:: -CollisionNode(const string &name) : +CollisionNode(const std::string &name) : PandaNode(name), _from_collide_mask(get_default_collide_mask()), _collider_sort(0) @@ -252,7 +252,7 @@ is_collision_node() const { * classes to include some information relevant to the class. */ void CollisionNode:: -output(ostream &out) const { +output(std::ostream &out) const { PandaNode::output(out); out << " (" << _solids.size() << " solids)"; } diff --git a/panda/src/collide/collisionParabola.cxx b/panda/src/collide/collisionParabola.cxx index 734647b16c..b439440228 100644 --- a/panda/src/collide/collisionParabola.cxx +++ b/panda/src/collide/collisionParabola.cxx @@ -90,7 +90,7 @@ get_test_pcollector() { * */ void CollisionParabola:: -output(ostream &out) const { +output(std::ostream &out) const { out << _parabola << ", t1 = " << _t1 << ", t2 = " << _t2; } @@ -145,8 +145,8 @@ compute_internal_bounds() const { for (int i = 0; i < num_points; ++i) { double t = (double)(i + 1) / (double)(num_points + 1); LPoint3 p = psp.calc_point(get_t1() + t * (get_t2() - get_t1())); - min_z = min(min_z, p[2]); - max_z = max(max_z, p[2]); + min_z = std::min(min_z, p[2]); + max_z = std::max(max_z, p[2]); } // That gives us a simple bounding volume in parabola space. diff --git a/panda/src/collide/collisionPlane.cxx b/panda/src/collide/collisionPlane.cxx index f869f6c2d1..8a325ea082 100644 --- a/panda/src/collide/collisionPlane.cxx +++ b/panda/src/collide/collisionPlane.cxx @@ -89,7 +89,7 @@ get_test_pcollector() { * */ void CollisionPlane:: -output(ostream &out) const { +output(std::ostream &out) const { out << "cplane, (" << _plane << ")"; } @@ -397,7 +397,7 @@ test_intersection_from_parabola(const CollisionEntry &entry) const { if (t2 >= parabola->get_t1() && t2 <= parabola->get_t2()) { // Both intersection points are within our segment of the parabola. // Choose the first of the two. - t = min(t1, t2); + t = std::min(t1, t2); } else { // Only t1 is within our segment. t = t1; diff --git a/panda/src/collide/collisionPolygon.cxx b/panda/src/collide/collisionPolygon.cxx index 2e907c0695..25dc01d272 100644 --- a/panda/src/collide/collisionPolygon.cxx +++ b/panda/src/collide/collisionPolygon.cxx @@ -41,6 +41,9 @@ #include +using std::max; +using std::min; + PStatCollector CollisionPolygon::_volume_pcollector("Collision Volumes:CollisionPolygon"); PStatCollector CollisionPolygon::_test_pcollector("Collision Tests:CollisionPolygon"); TypeHandle CollisionPolygon::_type_handle; @@ -296,7 +299,7 @@ get_test_pcollector() { * */ void CollisionPolygon:: -output(ostream &out) const { +output(std::ostream &out) const { out << "cpolygon, (" << get_plane() << "), " << _points.size() << " vertices"; } @@ -305,7 +308,7 @@ output(ostream &out) const { * */ void CollisionPolygon:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << (*this) << "\n"; Points::const_iterator pi; for (pi = _points.begin(); pi != _points.end(); ++pi) { diff --git a/panda/src/collide/collisionRay.cxx b/panda/src/collide/collisionRay.cxx index 05aa445aa1..9cbf9223fe 100644 --- a/panda/src/collide/collisionRay.cxx +++ b/panda/src/collide/collisionRay.cxx @@ -72,7 +72,7 @@ get_collision_origin() const { * */ void CollisionRay:: -output(ostream &out) const { +output(std::ostream &out) const { out << "ray, o (" << get_origin() << "), d (" << get_direction() << ")"; } diff --git a/panda/src/collide/collisionRecorder.cxx b/panda/src/collide/collisionRecorder.cxx index 45580e97f1..9abd0814a7 100644 --- a/panda/src/collide/collisionRecorder.cxx +++ b/panda/src/collide/collisionRecorder.cxx @@ -42,7 +42,7 @@ CollisionRecorder:: * */ void CollisionRecorder:: -output(ostream &out) const { +output(std::ostream &out) const { out << "tested " << _num_missed + _num_detected << ", detected " << _num_detected << "\n"; } diff --git a/panda/src/collide/collisionSegment.cxx b/panda/src/collide/collisionSegment.cxx index 3fa0fe0524..802259b338 100644 --- a/panda/src/collide/collisionSegment.cxx +++ b/panda/src/collide/collisionSegment.cxx @@ -75,7 +75,7 @@ get_collision_origin() const { * */ void CollisionSegment:: -output(ostream &out) const { +output(std::ostream &out) const { out << "segment, a (" << _a << "), b (" << _b << ")"; } diff --git a/panda/src/collide/collisionSolid.cxx b/panda/src/collide/collisionSolid.cxx index f812c836f2..0e83c647de 100644 --- a/panda/src/collide/collisionSolid.cxx +++ b/panda/src/collide/collisionSolid.cxx @@ -174,7 +174,7 @@ get_test_pcollector() { * */ void CollisionSolid:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type(); } @@ -182,7 +182,7 @@ output(ostream &out) const { * */ void CollisionSolid:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << (*this) << "\n"; } diff --git a/panda/src/collide/collisionSphere.cxx b/panda/src/collide/collisionSphere.cxx index 898fbd86c6..a07b1fbcbc 100644 --- a/panda/src/collide/collisionSphere.cxx +++ b/panda/src/collide/collisionSphere.cxx @@ -33,6 +33,9 @@ #include "geomTristrips.h" #include "geomVertexWriter.h" +using std::max; +using std::min; + PStatCollector CollisionSphere::_volume_pcollector( "Collision Volumes:CollisionSphere"); PStatCollector CollisionSphere::_test_pcollector( @@ -102,7 +105,7 @@ get_test_pcollector() { * */ void CollisionSphere:: -output(ostream &out) const { +output(std::ostream &out) const { out << "sphere, c (" << get_center() << "), r " << get_radius(); } diff --git a/panda/src/collide/collisionTraverser.cxx b/panda/src/collide/collisionTraverser.cxx index 65f33cba31..6e8a01d68f 100644 --- a/panda/src/collide/collisionTraverser.cxx +++ b/panda/src/collide/collisionTraverser.cxx @@ -38,6 +38,8 @@ #include +using std::min; + PStatCollector CollisionTraverser::_collisions_pcollector("App:Collisions"); PStatCollector CollisionTraverser::_cnode_volume_pcollector("Collision Volumes:CollisionNode"); @@ -67,7 +69,7 @@ public: * */ CollisionTraverser:: -CollisionTraverser(const string &name) : +CollisionTraverser(const std::string &name) : Namable(name), _this_pcollector(_collisions_pcollector, name) { @@ -421,7 +423,7 @@ hide_collisions() { * */ void CollisionTraverser:: -output(ostream &out) const { +output(std::ostream &out) const { out << "CollisionTraverser, " << _colliders.size() << " colliders and " << _handlers.size() << " handlers.\n"; } @@ -430,7 +432,7 @@ output(ostream &out) const { * */ void CollisionTraverser:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << "CollisionTraverser, " << _colliders.size() << " colliders and " << _handlers.size() << " handlers:\n"; @@ -1389,7 +1391,7 @@ PStatCollector &CollisionTraverser:: get_pass_collector(int pass) { nassertr(pass >= 0, _this_pcollector); while ((int)_pass_collectors.size() <= pass) { - ostringstream name; + std::ostringstream name; name << "pass" << (_pass_collectors.size() + 1); PStatCollector col(_this_pcollector, name.str()); _pass_collectors.push_back(col); diff --git a/panda/src/collide/collisionTube.cxx b/panda/src/collide/collisionTube.cxx index b84e308395..174935368e 100644 --- a/panda/src/collide/collisionTube.cxx +++ b/panda/src/collide/collisionTube.cxx @@ -104,7 +104,7 @@ get_test_pcollector() { * */ void CollisionTube:: -output(ostream &out) const { +output(std::ostream &out) const { out << "tube, a (" << _a << "), b (" << _b << "), r " << _radius; } @@ -183,7 +183,7 @@ test_intersection_from_sphere(const CollisionEntry &entry) const { } // doubles, not floats, to satisfy min and max templates. - actual_t = min(1.0, max(0.0, t1)); + actual_t = std::min(1.0, std::max(0.0, t1)); contact_point = from_a + actual_t * (from_b - from_a); if (collide_cat.is_debug()) { @@ -824,7 +824,7 @@ intersects_parabola(double &t, const LParabola ¶bola, return false; } - t = max(t1a, 0.0); + t = std::max(t1a, 0.0); return true; } diff --git a/panda/src/collide/collisionVisualizer.cxx b/panda/src/collide/collisionVisualizer.cxx index 0c7861b5eb..0cebbeffdf 100644 --- a/panda/src/collide/collisionVisualizer.cxx +++ b/panda/src/collide/collisionVisualizer.cxx @@ -41,7 +41,7 @@ TypeHandle CollisionVisualizer::_type_handle; * */ CollisionVisualizer:: -CollisionVisualizer(const string &name) : PandaNode(name), _lock("CollisionVisualizer") { +CollisionVisualizer(const std::string &name) : PandaNode(name), _lock("CollisionVisualizer") { set_cull_callback(); // We always want to render the CollisionVisualizer node itself (even if it @@ -263,7 +263,7 @@ is_renderable() const { * classes to include some information relevant to the class. */ void CollisionVisualizer:: -output(ostream &out) const { +output(std::ostream &out) const { PandaNode::output(out); out << " "; CollisionRecorder::output(out); @@ -296,9 +296,9 @@ collision_tested(const CollisionEntry &entry, bool detected) { nassertv(!solid.is_null()); LightMutexHolder holder(_lock); - VizInfo &viz_info = _data[move(net_transform)]; + VizInfo &viz_info = _data[std::move(net_transform)]; if (detected) { - viz_info._solids[move(solid)]._detected_count++; + viz_info._solids[std::move(solid)]._detected_count++; if (entry.has_surface_point()) { CollisionPoint p; @@ -308,7 +308,7 @@ collision_tested(const CollisionEntry &entry, bool detected) { } } else { - viz_info._solids[move(solid)]._missed_count++; + viz_info._solids[std::move(solid)]._missed_count++; } } diff --git a/panda/src/cull/cullBinBackToFront.cxx b/panda/src/cull/cullBinBackToFront.cxx index 99da6cf5ac..00c6ba7c32 100644 --- a/panda/src/cull/cullBinBackToFront.cxx +++ b/panda/src/cull/cullBinBackToFront.cxx @@ -39,7 +39,7 @@ CullBinBackToFront:: * Factory constructor for passing to the CullBinManager. */ CullBin *CullBinBackToFront:: -make_bin(const string &name, GraphicsStateGuardianBase *gsg, +make_bin(const std::string &name, GraphicsStateGuardianBase *gsg, const PStatCollector &draw_region_pcollector) { return new CullBinBackToFront(name, gsg, draw_region_pcollector); } diff --git a/panda/src/cull/cullBinFixed.cxx b/panda/src/cull/cullBinFixed.cxx index e3e5637ad9..557b3435a3 100644 --- a/panda/src/cull/cullBinFixed.cxx +++ b/panda/src/cull/cullBinFixed.cxx @@ -39,7 +39,7 @@ CullBinFixed:: * Factory constructor for passing to the CullBinManager. */ CullBin *CullBinFixed:: -make_bin(const string &name, GraphicsStateGuardianBase *gsg, +make_bin(const std::string &name, GraphicsStateGuardianBase *gsg, const PStatCollector &draw_region_pcollector) { return new CullBinFixed(name, gsg, draw_region_pcollector); } diff --git a/panda/src/cull/cullBinFrontToBack.cxx b/panda/src/cull/cullBinFrontToBack.cxx index 4d297d1c94..4337b42d7c 100644 --- a/panda/src/cull/cullBinFrontToBack.cxx +++ b/panda/src/cull/cullBinFrontToBack.cxx @@ -39,7 +39,7 @@ CullBinFrontToBack:: * Factory constructor for passing to the CullBinManager. */ CullBin *CullBinFrontToBack:: -make_bin(const string &name, GraphicsStateGuardianBase *gsg, +make_bin(const std::string &name, GraphicsStateGuardianBase *gsg, const PStatCollector &draw_region_pcollector) { return new CullBinFrontToBack(name, gsg, draw_region_pcollector); } diff --git a/panda/src/cull/cullBinStateSorted.cxx b/panda/src/cull/cullBinStateSorted.cxx index 04890af48c..ad4d26cd12 100644 --- a/panda/src/cull/cullBinStateSorted.cxx +++ b/panda/src/cull/cullBinStateSorted.cxx @@ -38,7 +38,7 @@ CullBinStateSorted:: * Factory constructor for passing to the CullBinManager. */ CullBin *CullBinStateSorted:: -make_bin(const string &name, GraphicsStateGuardianBase *gsg, +make_bin(const std::string &name, GraphicsStateGuardianBase *gsg, const PStatCollector &draw_region_pcollector) { return new CullBinStateSorted(name, gsg, draw_region_pcollector); } diff --git a/panda/src/cull/cullBinUnsorted.cxx b/panda/src/cull/cullBinUnsorted.cxx index 4ef8c35ae6..14766f9bbd 100644 --- a/panda/src/cull/cullBinUnsorted.cxx +++ b/panda/src/cull/cullBinUnsorted.cxx @@ -35,7 +35,7 @@ CullBinUnsorted:: * Factory constructor for passing to the CullBinManager. */ CullBin *CullBinUnsorted:: -make_bin(const string &name, GraphicsStateGuardianBase *gsg, +make_bin(const std::string &name, GraphicsStateGuardianBase *gsg, const PStatCollector &draw_region_pcollector) { return new CullBinUnsorted(name, gsg, draw_region_pcollector); } diff --git a/panda/src/device/analogNode.cxx b/panda/src/device/analogNode.cxx index 4f331c7bae..59e57f4179 100644 --- a/panda/src/device/analogNode.cxx +++ b/panda/src/device/analogNode.cxx @@ -23,7 +23,7 @@ TypeHandle AnalogNode::_type_handle; * */ AnalogNode:: -AnalogNode(ClientBase *client, const string &device_name) : +AnalogNode(ClientBase *client, const std::string &device_name) : DataNode(device_name) { _xy_output = define_output("xy", EventStoreVec2::get_class_type()); @@ -63,7 +63,7 @@ AnalogNode:: * */ void AnalogNode:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { DataNode::write(out, indent_level); if (_analog != nullptr) { diff --git a/panda/src/device/buttonNode.cxx b/panda/src/device/buttonNode.cxx index e2bb18eeee..67803cf658 100644 --- a/panda/src/device/buttonNode.cxx +++ b/panda/src/device/buttonNode.cxx @@ -23,7 +23,7 @@ TypeHandle ButtonNode::_type_handle; * */ ButtonNode:: -ButtonNode(ClientBase *client, const string &device_name) : +ButtonNode(ClientBase *client, const std::string &device_name) : DataNode(device_name) { _button_events_output = define_output("button_events", ButtonEventList::get_class_type()); @@ -63,7 +63,7 @@ ButtonNode:: * */ void ButtonNode:: -output(ostream &out) const { +output(std::ostream &out) const { DataNode::output(out); if (_button != nullptr) { @@ -79,7 +79,7 @@ output(ostream &out) const { * */ void ButtonNode:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { DataNode::write(out, indent_level); if (_button != nullptr) { diff --git a/panda/src/device/clientAnalogDevice.cxx b/panda/src/device/clientAnalogDevice.cxx index 47ddde620b..eb9c72ee06 100644 --- a/panda/src/device/clientAnalogDevice.cxx +++ b/panda/src/device/clientAnalogDevice.cxx @@ -37,7 +37,7 @@ ensure_control_index(int index) { * */ void ClientAnalogDevice:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << get_type() << " " << get_device_name() << ":\n"; write_controls(out, indent_level + 2); } @@ -46,7 +46,7 @@ write(ostream &out, int indent_level) const { * Writes a multi-line description of the current analog control states. */ void ClientAnalogDevice:: -write_controls(ostream &out, int indent_level) const { +write_controls(std::ostream &out, int indent_level) const { bool any_controls = false; Controls::const_iterator ai; for (ai = _controls.begin(); ai != _controls.end(); ++ai) { diff --git a/panda/src/device/clientBase.cxx b/panda/src/device/clientBase.cxx index 2ad270b81b..b7c6c3347c 100644 --- a/panda/src/device/clientBase.cxx +++ b/panda/src/device/clientBase.cxx @@ -85,7 +85,7 @@ fork_asynchronous_thread(double poll_time) { if (device_cat.is_debug()) { device_cat.debug() << "fork_asynchronous_thread() - forking client thread" - << endl; + << std::endl; } return true; } @@ -113,7 +113,7 @@ fork_asynchronous_thread(double poll_time) { * NULL is returned. */ PT(ClientDevice) ClientBase:: -get_device(TypeHandle device_type, const string &device_name) { +get_device(TypeHandle device_type, const std::string &device_name) { DevicesByName &dbn = _devices[device_type]; DevicesByName::iterator dbni; @@ -143,7 +143,7 @@ get_device(TypeHandle device_type, const string &device_name) { * unknown (e.g. it was disconnected previously). */ bool ClientBase:: -disconnect_device(TypeHandle device_type, const string &device_name, +disconnect_device(TypeHandle device_type, const std::string &device_name, ClientDevice *device) { DevicesByName &dbn = _devices[device_type]; diff --git a/panda/src/device/clientButtonDevice.cxx b/panda/src/device/clientButtonDevice.cxx index 60952f6a2c..27451c2887 100644 --- a/panda/src/device/clientButtonDevice.cxx +++ b/panda/src/device/clientButtonDevice.cxx @@ -15,13 +15,15 @@ #include "indent.h" +using std::ostream; + TypeHandle ClientButtonDevice::_type_handle; /** * */ ClientButtonDevice:: -ClientButtonDevice(ClientBase *client, const string &device_name): +ClientButtonDevice(ClientBase *client, const std::string &device_name): ClientDevice(client, get_class_type(), device_name) { _button_events = new ButtonEventList(); diff --git a/panda/src/device/clientDevice.cxx b/panda/src/device/clientDevice.cxx index f6bca213e5..6da404eca4 100644 --- a/panda/src/device/clientDevice.cxx +++ b/panda/src/device/clientDevice.cxx @@ -23,7 +23,7 @@ TypeHandle ClientDevice::_type_handle; */ ClientDevice:: ClientDevice(ClientBase *client, TypeHandle device_type, - const string &device_name) : + const std::string &device_name) : _client(client), _device_type(device_type), _device_name(device_name) @@ -87,7 +87,7 @@ poll() { * */ void ClientDevice:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type() << " " << get_device_name(); } @@ -95,6 +95,6 @@ output(ostream &out) const { * */ void ClientDevice:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << *this << "\n"; } diff --git a/panda/src/device/dialNode.cxx b/panda/src/device/dialNode.cxx index 86fa011908..04f46a7805 100644 --- a/panda/src/device/dialNode.cxx +++ b/panda/src/device/dialNode.cxx @@ -22,7 +22,7 @@ TypeHandle DialNode::_type_handle; * */ DialNode:: -DialNode(ClientBase *client, const string &device_name) : +DialNode(ClientBase *client, const std::string &device_name) : DataNode(device_name) { nassertv(client != nullptr); diff --git a/panda/src/device/mouseAndKeyboard.cxx b/panda/src/device/mouseAndKeyboard.cxx index 4a431c5e5e..4a8e599afe 100644 --- a/panda/src/device/mouseAndKeyboard.cxx +++ b/panda/src/device/mouseAndKeyboard.cxx @@ -24,7 +24,7 @@ TypeHandle MouseAndKeyboard::_type_handle; * */ MouseAndKeyboard:: -MouseAndKeyboard(GraphicsWindow *window, int device, const string &name) : +MouseAndKeyboard(GraphicsWindow *window, int device, const std::string &name) : DataNode(name), _window(window), _device(device) diff --git a/panda/src/device/trackerNode.cxx b/panda/src/device/trackerNode.cxx index cf4a8d0f01..0ec33af92f 100644 --- a/panda/src/device/trackerNode.cxx +++ b/panda/src/device/trackerNode.cxx @@ -21,7 +21,7 @@ TypeHandle TrackerNode::_type_handle; * */ TrackerNode:: -TrackerNode(ClientBase *client, const string &device_name) : +TrackerNode(ClientBase *client, const std::string &device_name) : DataNode(device_name) { _transform_output = define_output("transform", TransformState::get_class_type()); diff --git a/panda/src/device/virtualMouse.cxx b/panda/src/device/virtualMouse.cxx index fc0782828b..cdbf5aa678 100644 --- a/panda/src/device/virtualMouse.cxx +++ b/panda/src/device/virtualMouse.cxx @@ -20,7 +20,7 @@ TypeHandle VirtualMouse::_type_handle; * */ VirtualMouse:: -VirtualMouse(const string &name) : +VirtualMouse(const std::string &name) : DataNode(name) { _pixel_xy_output = define_output("pixel_xy", EventStoreVec2::get_class_type()); diff --git a/panda/src/dgraph/dataNode.cxx b/panda/src/dgraph/dataNode.cxx index 564a19f45d..a67c0b0c0d 100644 --- a/panda/src/dgraph/dataNode.cxx +++ b/panda/src/dgraph/dataNode.cxx @@ -16,6 +16,8 @@ #include "config_dgraph.h" #include "dcast.h" +using std::string; + TypeHandle DataNode::_type_handle; /** @@ -100,7 +102,7 @@ transmit_data(DataGraphTraverser *trav, * might expect to receive. */ void DataNode:: -write_inputs(ostream &out) const { +write_inputs(std::ostream &out) const { Wires::const_iterator wi; for (wi = _input_wires.begin(); wi != _input_wires.end(); ++wi) { const string &name = (*wi).first; @@ -114,7 +116,7 @@ write_inputs(ostream &out) const { * might generate. */ void DataNode:: -write_outputs(ostream &out) const { +write_outputs(std::ostream &out) const { Wires::const_iterator wi; for (wi = _output_wires.begin(); wi != _output_wires.end(); ++wi) { const string &name = (*wi).first; @@ -128,7 +130,7 @@ write_outputs(ostream &out) const { * showing between this DataNode and its parent(s). */ void DataNode:: -write_connections(ostream &out) const { +write_connections(std::ostream &out) const { DataConnections::const_iterator ci; for (ci = _data_connections.begin(); ci != _data_connections.end(); ++ci) { const DataConnection &connect = (*ci); diff --git a/panda/src/display/callbackGraphicsWindow.cxx b/panda/src/display/callbackGraphicsWindow.cxx index 7774b149c2..ebe2442d17 100644 --- a/panda/src/display/callbackGraphicsWindow.cxx +++ b/panda/src/display/callbackGraphicsWindow.cxx @@ -24,7 +24,7 @@ TypeHandle CallbackGraphicsWindow::RenderCallbackData::_type_handle; */ CallbackGraphicsWindow:: CallbackGraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe, - const string &name, + const std::string &name, const FrameBufferProperties &fb_prop, const WindowProperties &win_prop, int flags, @@ -65,7 +65,7 @@ get_input_device(int device) { * Returns the index of the new device. */ int CallbackGraphicsWindow:: -create_input_device(const string &name) { +create_input_device(const std::string &name) { GraphicsWindowInputDevice device = GraphicsWindowInputDevice::pointer_and_keyboard(this, name); return add_input_device(device); diff --git a/panda/src/display/displayInformation.cxx b/panda/src/display/displayInformation.cxx index df1cec1420..337da59699 100644 --- a/panda/src/display/displayInformation.cxx +++ b/panda/src/display/displayInformation.cxx @@ -46,7 +46,7 @@ operator != (const DisplayMode &other) const { * */ void DisplayMode:: -output(ostream &out) const { +output(std::ostream &out) const { out << width << 'x' << height; if (bits_per_pixel > 0) { out << ' ' << bits_per_pixel << "bpp"; @@ -489,7 +489,7 @@ get_driver_date_year() { /** * */ -const string &DisplayInformation:: +const std::string &DisplayInformation:: get_cpu_vendor_string() const { return _cpu_vendor_string; } @@ -497,7 +497,7 @@ get_cpu_vendor_string() const { /** * */ -const string &DisplayInformation:: +const std::string &DisplayInformation:: get_cpu_brand_string() const { return _cpu_brand_string; } diff --git a/panda/src/display/displayRegion.cxx b/panda/src/display/displayRegion.cxx index b1d99df839..e32b0f5a50 100644 --- a/panda/src/display/displayRegion.cxx +++ b/panda/src/display/displayRegion.cxx @@ -23,6 +23,8 @@ #include +using std::string; + TypeHandle DisplayRegion::_type_handle; TypeHandle DisplayRegionPipelineReader::_type_handle; @@ -339,7 +341,7 @@ set_target_tex_page(int page) { * */ void DisplayRegion:: -output(ostream &out) const { +output(std::ostream &out) const { CDReader cdata(_cycler); out << "DisplayRegion(" << cdata->_regions[0]._dimensions << ")=pixels(" << cdata->_regions[0]._pixels << ")"; @@ -363,7 +365,7 @@ make_screenshot_filename(const string &prefix) { static const int buffer_size = 1024; char buffer[buffer_size]; - ostringstream filename_strm; + std::ostringstream filename_strm; size_t i = 0; while (i < screenshot_filename.length()) { @@ -668,7 +670,7 @@ do_compute_pixels(int i, int x_size, int y_size, CData *cdata) { void DisplayRegion:: set_active_index(int index) { #ifdef DO_PSTATS - ostringstream strm; + std::ostringstream strm; strm << "dr_" << index; string name = strm.str(); diff --git a/panda/src/display/displayRegionCullCallbackData.cxx b/panda/src/display/displayRegionCullCallbackData.cxx index 39268fbabe..822ecdce7b 100644 --- a/panda/src/display/displayRegionCullCallbackData.cxx +++ b/panda/src/display/displayRegionCullCallbackData.cxx @@ -33,7 +33,7 @@ DisplayRegionCullCallbackData(CullHandler *cull_handler, SceneSetup *scene_setup * */ void DisplayRegionCullCallbackData:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type() << "(" << (void *)_cull_handler << ", " << (void *)_scene_setup << ")"; } diff --git a/panda/src/display/displayRegionDrawCallbackData.cxx b/panda/src/display/displayRegionDrawCallbackData.cxx index 194aa6bbef..b95a3086e2 100644 --- a/panda/src/display/displayRegionDrawCallbackData.cxx +++ b/panda/src/display/displayRegionDrawCallbackData.cxx @@ -37,7 +37,7 @@ DisplayRegionDrawCallbackData(CullResult *cull_result, SceneSetup *scene_setup) * */ void DisplayRegionDrawCallbackData:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type() << "(" << (void *)_cull_result << ", " << (void *)_scene_setup << ")"; } diff --git a/panda/src/display/frameBufferProperties.cxx b/panda/src/display/frameBufferProperties.cxx index 81d12a98ba..cb6d14da3f 100644 --- a/panda/src/display/frameBufferProperties.cxx +++ b/panda/src/display/frameBufferProperties.cxx @@ -213,7 +213,7 @@ add_properties(const FrameBufferProperties &other) { * Generates a string representation. */ void FrameBufferProperties:: -output(ostream &out) const { +output(std::ostream &out) const { if ((_flags & FBF_float_depth) != 0) { out << "float_depth "; } @@ -542,7 +542,7 @@ get_quality(const FrameBufferProperties &reqs) const { for (int prop = FBP_aux_rgba; prop <= FBP_aux_float; ++prop) { int extra = _property[prop] > reqs._property[prop]; if (extra > 0) { - extra = min(extra, 3); + extra = std::min(extra, 3); quality -= extra*50; } } @@ -601,7 +601,7 @@ get_quality(const FrameBufferProperties &reqs) const { * false. */ bool FrameBufferProperties:: -verify_hardware_software(const FrameBufferProperties &props, const string &renderer) const { +verify_hardware_software(const FrameBufferProperties &props, const std::string &renderer) const { if (get_force_hardware() < props.get_force_hardware()) { display_cat.error() diff --git a/panda/src/display/graphicsBuffer.cxx b/panda/src/display/graphicsBuffer.cxx index bb0b086309..6955305a96 100644 --- a/panda/src/display/graphicsBuffer.cxx +++ b/panda/src/display/graphicsBuffer.cxx @@ -21,7 +21,7 @@ TypeHandle GraphicsBuffer::_type_handle; */ GraphicsBuffer:: GraphicsBuffer(GraphicsEngine *engine, GraphicsPipe *pipe, - const string &name, + const std::string &name, const FrameBufferProperties &fb_prop, const WindowProperties &win_prop, int flags, GraphicsStateGuardian *gsg, diff --git a/panda/src/display/graphicsEngine.cxx b/panda/src/display/graphicsEngine.cxx index b27eaa5c39..0b4e8448b1 100644 --- a/panda/src/display/graphicsEngine.cxx +++ b/panda/src/display/graphicsEngine.cxx @@ -57,6 +57,8 @@ #include #endif +using std::string; + PT(GraphicsEngine) GraphicsEngine::_global_ptr; PStatCollector GraphicsEngine::_wait_pcollector("Wait:Thread sync"); @@ -1511,7 +1513,7 @@ cull_to_bins(GraphicsEngine::Windows wlist, Thread *current_thread) { key._lens_index = dr_reader.get_lens_index(); } - AlreadyCulled::iterator aci = already_culled.insert(AlreadyCulled::value_type(move(key), nullptr)).first; + AlreadyCulled::iterator aci = already_culled.insert(AlreadyCulled::value_type(std::move(key), nullptr)).first; if ((*aci).second == nullptr) { // We have not used this camera already in this thread. Perform // the cull operation. @@ -1537,7 +1539,7 @@ cull_to_bins(GraphicsEngine::Windows wlist, Thread *current_thread) { } // Save the results for next frame. - dr->set_cull_result(move(cull_result), MOVE(scene_setup), current_thread); + dr->set_cull_result(std::move(cull_result), MOVE(scene_setup), current_thread); } } } diff --git a/panda/src/display/graphicsOutput.cxx b/panda/src/display/graphicsOutput.cxx index 1f3141e9fc..7c6cef51cb 100644 --- a/panda/src/display/graphicsOutput.cxx +++ b/panda/src/display/graphicsOutput.cxx @@ -34,6 +34,8 @@ #include "throw_event.h" #include "config_gobj.h" +using std::string; + TypeHandle GraphicsOutput::_type_handle; PStatCollector GraphicsOutput::_make_current_pcollector("Draw:Make current"); @@ -895,7 +897,7 @@ make_cube_map(const string &name, int size, NodePath &camera_rig, return nullptr; } if (max_dimension > 0) { - size = min(max_dimension, size); + size = std::min(max_dimension, size); } } @@ -1629,8 +1631,8 @@ make_copy() const { /** * */ -ostream & -operator << (ostream &out, GraphicsOutput::FrameMode fm) { +std::ostream & +operator << (std::ostream &out, GraphicsOutput::FrameMode fm) { switch (fm) { case GraphicsOutput::FM_render: return out << "render"; diff --git a/panda/src/display/graphicsPipe.cxx b/panda/src/display/graphicsPipe.cxx index 62a8ec5ad0..937987f567 100644 --- a/panda/src/display/graphicsPipe.cxx +++ b/panda/src/display/graphicsPipe.cxx @@ -134,8 +134,8 @@ GraphicsPipe() : if (max_cpuid >= 1) { get_cpuid(0, info); - swap(info.ecx, info.edx); - _display_information->_cpu_vendor_string = string(info.str + 4, 12); + std::swap(info.ecx, info.edx); + _display_information->_cpu_vendor_string = std::string(info.str + 4, 12); get_cpuid(1, info); _display_information->_cpu_version_information = info.eax; @@ -260,7 +260,7 @@ close_gsg(GraphicsStateGuardian *gsg) { * Creates a new window on the pipe, if possible. */ PT(GraphicsOutput) GraphicsPipe:: -make_output(const string &name, +make_output(const std::string &name, const FrameBufferProperties &fb_prop, const WindowProperties &win_prop, int flags, diff --git a/panda/src/display/graphicsPipeSelection.cxx b/panda/src/display/graphicsPipeSelection.cxx index d2b145da39..9c4f52ff63 100644 --- a/panda/src/display/graphicsPipeSelection.cxx +++ b/panda/src/display/graphicsPipeSelection.cxx @@ -23,6 +23,8 @@ #include +using std::string; + GraphicsPipeSelection *GraphicsPipeSelection::_global_ptr = nullptr; /** @@ -121,7 +123,7 @@ print_pipe_types() const { load_default_module(); LightMutexHolder holder(_lock); - nout << "Known pipe types:" << endl; + nout << "Known pipe types:" << std::endl; PipeTypes::const_iterator pi; for (pi = _pipe_types.begin(); pi != _pipe_types.end(); ++pi) { const PipeType &pipe_type = (*pi); @@ -406,11 +408,11 @@ load_named_module(const string &name) { // We have not yet loaded this module. Load it now. Filename dlname = Filename::dso_filename("lib" + name + ".so"); display_cat.info() - << "loading display module: " << dlname.to_os_specific() << endl; + << "loading display module: " << dlname.to_os_specific() << std::endl; void *handle = load_dso(get_plugin_path().get_value(), dlname); if (handle == nullptr) { display_cat.warning() - << "Unable to load: " << load_dso_error() << endl; + << "Unable to load: " << load_dso_error() << std::endl; return TypeHandle::none(); } diff --git a/panda/src/display/graphicsStateGuardian.cxx b/panda/src/display/graphicsStateGuardian.cxx index d0353717c9..94330cfa11 100644 --- a/panda/src/display/graphicsStateGuardian.cxx +++ b/panda/src/display/graphicsStateGuardian.cxx @@ -63,6 +63,8 @@ #include #include +using std::string; + PStatCollector GraphicsStateGuardian::_vertex_buffer_switch_pcollector("Buffer switch:Vertex"); PStatCollector GraphicsStateGuardian::_index_buffer_switch_pcollector("Buffer switch:Index"); PStatCollector GraphicsStateGuardian::_shader_buffer_switch_pcollector("Buffer switch:Shader"); @@ -2194,7 +2196,7 @@ flush_timer_queries() { if (_last_num_queried > 0) { // We know how many queries were available last frame, and this usually // stays fairly constant, so use this as a starting point. - int i = min(_last_num_queried, count) - 1; + int i = std::min(_last_num_queried, count) - 1; if (_pending_timer_queries[i]->is_answer_ready()) { first = count; @@ -2763,7 +2765,7 @@ do_issue_light() { // LightAttrib guarantees that the on lights are sorted, and that // non-ambient lights come before ambient lights. any_on_lights = target_light->has_any_on_light(); - size_t filtered_lights = min((size_t)_max_lights, target_light->get_num_non_ambient_lights()); + size_t filtered_lights = std::min((size_t)_max_lights, target_light->get_num_non_ambient_lights()); for (size_t li = 0; li < filtered_lights; ++li) { NodePath light = target_light->get_on_light(li); nassertv(!light.is_empty()); @@ -3241,7 +3243,7 @@ async_reload_texture(TextureContext *tc) { ((TextureReloadRequest *)task)->get_texture() == tc->get_texture()) { // This texture is already queued to be reloaded. Don't queue it again, // just make sure the priority is updated, and return. - task->set_priority(max(task->get_priority(), priority)); + task->set_priority(std::max(task->get_priority(), priority)); return (AsyncFuture *)task; } } @@ -3498,8 +3500,8 @@ get_driver_shader_version_minor() { return -1; } -ostream & -operator << (ostream &out, GraphicsStateGuardian::ShaderModel sm) { +std::ostream & +operator << (std::ostream &out, GraphicsStateGuardian::ShaderModel sm) { static const char *sm_strings[] = {"none", "1.1", "2.0", "2.x", "3.0", "4.0", "5.0", "5.1"}; nassertr(sm >= 0 && sm <= GraphicsStateGuardian::SM_51, out); out << sm_strings[sm]; diff --git a/panda/src/display/graphicsThreadingModel.cxx b/panda/src/display/graphicsThreadingModel.cxx index 113352ecba..22357206da 100644 --- a/panda/src/display/graphicsThreadingModel.cxx +++ b/panda/src/display/graphicsThreadingModel.cxx @@ -13,6 +13,8 @@ #include "graphicsThreadingModel.h" +using std::string; + /** * The threading model accepts a string representing the names of the two * threads that will process cull and draw for the given window, separated by diff --git a/panda/src/display/graphicsWindow.cxx b/panda/src/display/graphicsWindow.cxx index c3dadfa08c..8d618f3d9b 100644 --- a/panda/src/display/graphicsWindow.cxx +++ b/panda/src/display/graphicsWindow.cxx @@ -21,6 +21,8 @@ #include "throw_event.h" #include "string_utils.h" +using std::string; + TypeHandle GraphicsWindow::_type_handle; /** diff --git a/panda/src/display/graphicsWindowInputDevice.cxx b/panda/src/display/graphicsWindowInputDevice.cxx index f2af1e9df1..377f3986e4 100644 --- a/panda/src/display/graphicsWindowInputDevice.cxx +++ b/panda/src/display/graphicsWindowInputDevice.cxx @@ -23,6 +23,8 @@ #include "vector_src.cxx" +using std::string; + /** * Defines a new InputDevice for the window. Most windows will have exactly * one InputDevice: a keyboard/mouse pair. Some may also add joystick data, @@ -281,7 +283,7 @@ keystroke(int keycode, double time) { * especially Chinese/Japanese/Korean. */ void GraphicsWindowInputDevice:: -candidate(const wstring &candidate_string, size_t highlight_start, +candidate(const std::wstring &candidate_string, size_t highlight_start, size_t highlight_end, size_t cursor_pos) { LightMutexHolder holder(_lock); _button_events.push_back(ButtonEvent(candidate_string, diff --git a/panda/src/display/graphicsWindowProcCallbackData.cxx b/panda/src/display/graphicsWindowProcCallbackData.cxx index 8bf1da03af..82e57ef382 100644 --- a/panda/src/display/graphicsWindowProcCallbackData.cxx +++ b/panda/src/display/graphicsWindowProcCallbackData.cxx @@ -20,7 +20,7 @@ TypeHandle GraphicsWindowProcCallbackData::_type_handle; * */ void GraphicsWindowProcCallbackData:: -output(ostream &out) const { +output(std::ostream &out) const { #ifdef WIN32 out << get_type() << "(" << (void*)_graphicsWindow << ", " << _hwnd << ", " << _msg << ", " << _wparam << ", " << _lparam << ")"; diff --git a/panda/src/display/nativeWindowHandle.cxx b/panda/src/display/nativeWindowHandle.cxx index 7616471172..2ae1973a6f 100644 --- a/panda/src/display/nativeWindowHandle.cxx +++ b/panda/src/display/nativeWindowHandle.cxx @@ -13,6 +13,8 @@ #include "nativeWindowHandle.h" +using std::ostream; + TypeHandle NativeWindowHandle::_type_handle; TypeHandle NativeWindowHandle::IntHandle::_type_handle; TypeHandle NativeWindowHandle::SubprocessHandle::_type_handle; diff --git a/panda/src/display/parasiteBuffer.cxx b/panda/src/display/parasiteBuffer.cxx index c03d799f4c..1b23fdb653 100644 --- a/panda/src/display/parasiteBuffer.cxx +++ b/panda/src/display/parasiteBuffer.cxx @@ -21,7 +21,7 @@ TypeHandle ParasiteBuffer::_type_handle; * created instead via the GraphicsEngine::make_parasite() function. */ ParasiteBuffer:: -ParasiteBuffer(GraphicsOutput *host, const string &name, +ParasiteBuffer(GraphicsOutput *host, const std::string &name, int x_size, int y_size, int flags) : GraphicsOutput(host->get_engine(), host->get_pipe(), name, host->get_fb_properties(), @@ -95,7 +95,7 @@ set_size_and_recalc(int x, int y) { y = Texture::down_to_power_2(y); } if (_creation_flags & GraphicsPipe::BF_size_square) { - x = y = min(x, y); + x = y = std::min(x, y); } } @@ -180,8 +180,8 @@ begin_frame(FrameMode mode, Thread *current_thread) { } else { if (_host->get_x_size() < get_x_size() || _host->get_y_size() < get_y_size()) { - set_size_and_recalc(min(get_x_size(), _host->get_x_size()), - min(get_y_size(), _host->get_y_size())); + set_size_and_recalc(std::min(get_x_size(), _host->get_x_size()), + std::min(get_y_size(), _host->get_y_size())); } } diff --git a/panda/src/display/stereoDisplayRegion.cxx b/panda/src/display/stereoDisplayRegion.cxx index 3b3a7cf9f8..5151920cab 100644 --- a/panda/src/display/stereoDisplayRegion.cxx +++ b/panda/src/display/stereoDisplayRegion.cxx @@ -262,7 +262,7 @@ set_target_tex_page(int page) { * */ void StereoDisplayRegion:: -output(ostream &out) const { +output(std::ostream &out) const { out << "StereoDisplayRegion(" << *_left_eye << ")"; } diff --git a/panda/src/display/subprocessWindow.cxx b/panda/src/display/subprocessWindow.cxx index 261c7f161a..fe4b2eff5d 100644 --- a/panda/src/display/subprocessWindow.cxx +++ b/panda/src/display/subprocessWindow.cxx @@ -19,6 +19,8 @@ #include "config_display.h" #include "nativeWindowHandle.h" +using std::string; + TypeHandle SubprocessWindow::_type_handle; /** diff --git a/panda/src/display/subprocessWindowBuffer.cxx b/panda/src/display/subprocessWindowBuffer.cxx index f2f7eea2cb..168e7f0758 100644 --- a/panda/src/display/subprocessWindowBuffer.cxx +++ b/panda/src/display/subprocessWindowBuffer.cxx @@ -19,6 +19,9 @@ #include +using std::cerr; +using std::string; + const char SubprocessWindowBuffer:: _magic_number[SubprocessWindowBuffer::magic_number_length] = "pNdaSWB"; diff --git a/panda/src/display/windowHandle.cxx b/panda/src/display/windowHandle.cxx index c114da8adf..0bfec17af7 100644 --- a/panda/src/display/windowHandle.cxx +++ b/panda/src/display/windowHandle.cxx @@ -52,7 +52,7 @@ get_int_handle() const { * */ void WindowHandle:: -output(ostream &out) const { +output(std::ostream &out) const { if (_os_handle == nullptr) { out << "(null)"; } else { @@ -117,6 +117,6 @@ get_int_handle() const { * */ void WindowHandle::OSHandle:: -output(ostream &out) const { +output(std::ostream &out) const { out << "(no type)"; } diff --git a/panda/src/display/windowProperties.cxx b/panda/src/display/windowProperties.cxx index fec24e4faf..93cd0a7144 100644 --- a/panda/src/display/windowProperties.cxx +++ b/panda/src/display/windowProperties.cxx @@ -15,6 +15,10 @@ #include "config_display.h" #include "nativeWindowHandle.h" +using std::istream; +using std::ostream; +using std::string; + WindowProperties *WindowProperties::_default_properties = nullptr; /** diff --git a/panda/src/distort/nonlinearImager.cxx b/panda/src/distort/nonlinearImager.cxx index 551caac4d1..e0f86670a2 100644 --- a/panda/src/distort/nonlinearImager.cxx +++ b/panda/src/distort/nonlinearImager.cxx @@ -71,7 +71,7 @@ add_screen(ProjectionScreen *screen) { * The return value is the index number of the new screen. */ int NonlinearImager:: -add_screen(const NodePath &screen, const string &name) { +add_screen(const NodePath &screen, const std::string &name) { nassertr(!screen.is_empty() && screen.node()->is_of_type(ProjectionScreen::get_class_type()), -1); diff --git a/panda/src/distort/projectionScreen.cxx b/panda/src/distort/projectionScreen.cxx index 0ac8fd9edf..e3bed91e27 100644 --- a/panda/src/distort/projectionScreen.cxx +++ b/panda/src/distort/projectionScreen.cxx @@ -30,7 +30,7 @@ TypeHandle ProjectionScreen::_type_handle; * */ ProjectionScreen:: -ProjectionScreen(const string &name) : PandaNode(name) +ProjectionScreen(const std::string &name) : PandaNode(name) { set_cull_callback(); @@ -151,7 +151,7 @@ set_projector(const NodePath &projector) { * fraction, and make the screen smaller by the inverse fraction. */ PT(GeomNode) ProjectionScreen:: -generate_screen(const NodePath &projector, const string &screen_name, +generate_screen(const NodePath &projector, const std::string &screen_name, int num_x_verts, int num_y_verts, PN_stdfloat distance, PN_stdfloat fill_ratio) { nassertr(!projector.is_empty() && @@ -237,7 +237,7 @@ generate_screen(const NodePath &projector, const string &screen_name, * generated child returned by generate_screen(). */ void ProjectionScreen:: -regenerate_screen(const NodePath &projector, const string &screen_name, +regenerate_screen(const NodePath &projector, const std::string &screen_name, int num_x_verts, int num_y_verts, PN_stdfloat distance, PN_stdfloat fill_ratio) { // First, remove all existing children. diff --git a/panda/src/downloader/bioPtr.cxx b/panda/src/downloader/bioPtr.cxx index 8c5c76f636..eb12b2bd8b 100644 --- a/panda/src/downloader/bioPtr.cxx +++ b/panda/src/downloader/bioPtr.cxx @@ -31,6 +31,8 @@ #include #endif +using std::string; + #ifdef _WIN32 static string format_error() { PVOID buffer; diff --git a/panda/src/downloader/chunkedStreamBuf.cxx b/panda/src/downloader/chunkedStreamBuf.cxx index f6ddd39713..f9580b8e91 100644 --- a/panda/src/downloader/chunkedStreamBuf.cxx +++ b/panda/src/downloader/chunkedStreamBuf.cxx @@ -131,7 +131,7 @@ read_chars(char *start, size_t length) { if (_chunk_remaining != 0) { // Extract some of the bytes remaining in the chunk. - length = min(length, _chunk_remaining); + length = std::min(length, _chunk_remaining); (*_source)->read(start, length); size_t read_count = (*_source)->gcount(); if (!_wanted_nonblocking) { @@ -153,7 +153,7 @@ read_chars(char *start, size_t length) { } // Read the next chunk. - string line; + std::string line; bool got_line = http_getline(line); while (got_line && line.empty()) { // Skip blank lines. There really should be exactly one blank line, but @@ -212,7 +212,7 @@ read_chars(char *start, size_t length) { * received or if the connection has been closed. */ bool ChunkedStreamBuf:: -http_getline(string &str) { +http_getline(std::string &str) { nassertr(!_source.is_null(), false); int ch = (*_source)->get(); while (!(*_source)->eof() && !(*_source)->fail()) { @@ -220,7 +220,7 @@ http_getline(string &str) { case '\n': // end-of-line character, we're done. str = _working_getline; - _working_getline = string(); + _working_getline = std::string(); { // Trim trailing whitespace. We're not required to do this per the // HTTP spec, but let's be generous. diff --git a/panda/src/downloader/decompressor.cxx b/panda/src/downloader/decompressor.cxx index b6bc542e60..272279047d 100644 --- a/panda/src/downloader/decompressor.cxx +++ b/panda/src/downloader/decompressor.cxx @@ -54,7 +54,7 @@ Decompressor:: */ int Decompressor:: initiate(const Filename &source_file) { - string extension = source_file.get_extension(); + std::string extension = source_file.get_extension(); if (extension == "pz" || extension == "gz") { Filename dest_file = source_file; dest_file = source_file.get_fullpath_wo_extension(); @@ -64,7 +64,7 @@ initiate(const Filename &source_file) { if (downloader_cat.is_debug()) { downloader_cat.debug() << "Unknown file extension for decompressor: ." - << extension << endl; + << extension << std::endl; } return EU_error_abort; } @@ -90,14 +90,14 @@ initiate(const Filename &source_file, const Filename &dest_file) { } // Determine source file length - source_pfstream->seekg(0, ios::end); + source_pfstream->seekg(0, std::ios::end); _source_length = source_pfstream->tellg(); if (_source_length == 0) { downloader_cat.warning() << "Zero length file: " << source_file << "\n"; return EU_error_file_empty; } - source_pfstream->seekg(0, ios::beg); + source_pfstream->seekg(0, std::ios::beg); // Open destination file Filename dest_filename(dest_file); @@ -201,8 +201,8 @@ decompress(const Filename &source_file) { */ bool Decompressor:: decompress(Ramfile &source_and_dest_file) { - istringstream source(source_and_dest_file._data); - ostringstream dest; + std::istringstream source(source_and_dest_file._data); + std::ostringstream dest; IDecompressStream decompress(&source, false); diff --git a/panda/src/downloader/documentSpec.cxx b/panda/src/downloader/documentSpec.cxx index b9ccc7097d..6ca2a9b260 100644 --- a/panda/src/downloader/documentSpec.cxx +++ b/panda/src/downloader/documentSpec.cxx @@ -51,7 +51,7 @@ compare_to(const DocumentSpec &other) const { * output() or write(). Returns true on success, false on failure. */ bool DocumentSpec:: -input(istream &in) { +input(std::istream &in) { // First, clear the spec. (*this) = DocumentSpec(); @@ -64,7 +64,7 @@ input(istream &in) { in >> ch; if (ch == '(') { // Scan the tag, up to but not including the closing paren. - string tag; + std::string tag; in >> ch; while (!in.fail() && !in.eof() && ch != ')') { tag += ch; @@ -80,7 +80,7 @@ input(istream &in) { // Scan the date, up to but not including the closing bracket. if (ch != ']') { - string date; + std::string date; while (!in.fail() && !in.eof() && ch != ']') { date += ch; ch = in.get(); @@ -99,7 +99,7 @@ input(istream &in) { * */ void DocumentSpec:: -output(ostream &out) const { +output(std::ostream &out) const { out << "[ " << get_url(); if (has_tag()) { out << " (" << get_tag() << ")"; @@ -114,7 +114,7 @@ output(ostream &out) const { * */ void DocumentSpec:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << "[ " << get_url(); if (has_tag()) { diff --git a/panda/src/downloader/downloadDb.cxx b/panda/src/downloader/downloadDb.cxx index d532009e2b..0679614c8b 100644 --- a/panda/src/downloader/downloadDb.cxx +++ b/panda/src/downloader/downloadDb.cxx @@ -20,6 +20,13 @@ #include +using std::endl; +using std::istream; +using std::istringstream; +using std::move; +using std::ostream; +using std::string; + // Defines // Written at the top of the file so we know this is a downloadDb diff --git a/panda/src/downloader/download_utils.cxx b/panda/src/downloader/download_utils.cxx index e090627362..ebeec3a97c 100644 --- a/panda/src/downloader/download_utils.cxx +++ b/panda/src/downloader/download_utils.cxx @@ -19,13 +19,15 @@ #include "config_downloader.h" #include +using std::ios; + unsigned long check_crc(Filename name) { pifstream read_stream; name.set_binary(); if (!name.open_read(read_stream)) { downloader_cat.error() - << "check_crc() - Failed to open input file: " << name << endl; + << "check_crc() - Failed to open input file: " << name << std::endl; return 0; } @@ -51,7 +53,7 @@ check_adler(Filename name) { name.set_binary(); if (!name.open_read(read_stream)) { downloader_cat.error() - << "check_adler() - Failed to open input file: " << name << endl; + << "check_adler() - Failed to open input file: " << name << std::endl; return 0; } diff --git a/panda/src/downloader/extractor.cxx b/panda/src/downloader/extractor.cxx index 81568ae951..a78e9a340d 100644 --- a/panda/src/downloader/extractor.cxx +++ b/panda/src/downloader/extractor.cxx @@ -192,7 +192,7 @@ step() { static const size_t buffer_size = 1024; char buffer[buffer_size]; - size_t max_bytes = min(buffer_size, _subfile_length - _subfile_pos); + size_t max_bytes = std::min(buffer_size, _subfile_length - _subfile_pos); _read->read(buffer, max_bytes); size_t count = _read->gcount(); while (count != 0) { @@ -217,7 +217,7 @@ step() { return EU_ok; } - max_bytes = min(buffer_size, _subfile_length - _subfile_pos); + max_bytes = std::min(buffer_size, _subfile_length - _subfile_pos); _read->read(buffer, max_bytes); count = _read->gcount(); } diff --git a/panda/src/downloader/httpAuthorization.cxx b/panda/src/downloader/httpAuthorization.cxx index d067b96d97..081f16532d 100644 --- a/panda/src/downloader/httpAuthorization.cxx +++ b/panda/src/downloader/httpAuthorization.cxx @@ -17,6 +17,8 @@ #ifdef HAVE_OPENSSL +using std::string; + static const char base64_table[64] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', diff --git a/panda/src/downloader/httpBasicAuthorization.cxx b/panda/src/downloader/httpBasicAuthorization.cxx index 8e86c25a94..a8abd67979 100644 --- a/panda/src/downloader/httpBasicAuthorization.cxx +++ b/panda/src/downloader/httpBasicAuthorization.cxx @@ -15,6 +15,8 @@ #ifdef HAVE_OPENSSL +using std::string; + const string HTTPBasicAuthorization::_mechanism = "basic"; /** diff --git a/panda/src/downloader/httpChannel.cxx b/panda/src/downloader/httpChannel.cxx index 990c89d4e6..17c12d806a 100644 --- a/panda/src/downloader/httpChannel.cxx +++ b/panda/src/downloader/httpChannel.cxx @@ -35,6 +35,12 @@ #undef X509_NAME #endif // WIN32_VC +using std::istream; +using std::min; +using std::ostream; +using std::ostringstream; +using std::string; + TypeHandle HTTPChannel::_type_handle; #define _NOTIFY_HTTP_CHANNEL_ID "[" << this << "] " @@ -250,7 +256,7 @@ will_close_connection() const { * requests which can change their minds midstream about how much data they're * sending you. */ -streamsize HTTPChannel:: +std::streamsize HTTPChannel:: get_file_size() const { if (_got_file_size) { return _file_size; @@ -2678,7 +2684,7 @@ open_download_file() { // Windows doesn't complain if you try to seek past the end of file--it // happily appends enough zero bytes to make the difference. Blecch. // That means we need to get the file size first to check it ourselves. - _download_to_stream->seekp(0, ios::end); + _download_to_stream->seekp(0, std::ios::end); if (_first_byte_delivered > (size_t)_download_to_stream->tellp()) { downloader_cat.info() << _NOTIFY_HTTP_CHANNEL_ID @@ -2716,7 +2722,7 @@ open_download_file() { // Windows doesn't complain if you try to seek past the end of file--it // happily appends enough zero bytes to make the difference. Blecch. // That means we need to get the file size first to check it ourselves. - _download_to_stream->seekp(0, ios::end); + _download_to_stream->seekp(0, std::ios::end); if (_first_byte_delivered > (size_t)_download_to_stream->tellp()) { downloader_cat.info() << _NOTIFY_HTTP_CHANNEL_ID @@ -3711,7 +3717,7 @@ reset_url(const URLSpec &old_url, const URLSpec &new_url) { */ void HTTPChannel:: store_header_field(const string &field_name, const string &field_value) { - pair insert_result = + std::pair insert_result = _headers.insert(Headers::value_type(field_name, field_value)); if (!insert_result.second) { diff --git a/panda/src/downloader/httpClient.cxx b/panda/src/downloader/httpClient.cxx index 7183b36ddf..1f80bf61fd 100644 --- a/panda/src/downloader/httpClient.cxx +++ b/panda/src/downloader/httpClient.cxx @@ -26,6 +26,8 @@ #include "openSSLWrapper.h" +using std::string; + PT(HTTPClient) HTTPClient::_global_ptr; /** @@ -78,7 +80,7 @@ tokenize(const string &str, vector_string &words, const string &delimiters) { static void ssl_msg_callback(int write_p, int version, int content_type, const void *, size_t len, SSL *, void *) { - ostringstream describe; + std::ostringstream describe; if (write_p) { describe << "sent "; } else { @@ -701,7 +703,7 @@ set_cookie(const HTTPCookie &cookie) { clear_cookie(cookie); } else { - pair result = _cookies.insert(cookie); + std::pair result = _cookies.insert(cookie); if (!result.second) { // We already had a cookie matching the supplied domainpathname, so // replace it. @@ -778,7 +780,7 @@ copy_cookies_from(const HTTPClient &other) { * host). */ void HTTPClient:: -write_cookies(ostream &out) const { +write_cookies(std::ostream &out) const { Cookies::const_iterator ci; for (ci = _cookies.begin(); ci != _cookies.end(); ++ci) { out << *ci << "\n"; @@ -791,7 +793,7 @@ write_cookies(ostream &out) const { * also removes expired cookies. */ void HTTPClient:: -send_cookies(ostream &out, const URLSpec &url) { +send_cookies(std::ostream &out, const URLSpec &url) { HTTPDate now = HTTPDate::now(); bool any_expired = false; bool first_cookie = true; diff --git a/panda/src/downloader/httpCookie.cxx b/panda/src/downloader/httpCookie.cxx index cbe095cd8d..d09f12b856 100644 --- a/panda/src/downloader/httpCookie.cxx +++ b/panda/src/downloader/httpCookie.cxx @@ -18,6 +18,8 @@ #include "ctype.h" #include "httpChannel.h" +using std::string; + /** * The sorting operator allows the cookies to be stored in a single * dictionary; it returns nonequal only if the cookies are different in name, @@ -139,7 +141,7 @@ matches_url(const URLSpec &url) const { * */ void HTTPCookie:: -output(ostream &out) const { +output(std::ostream &out) const { out << _name << "=" << _value << "; path=" << _path << "; domain=" << _domain; diff --git a/panda/src/downloader/httpDate.cxx b/panda/src/downloader/httpDate.cxx index f8877a65c8..a651b50f89 100644 --- a/panda/src/downloader/httpDate.cxx +++ b/panda/src/downloader/httpDate.cxx @@ -15,6 +15,10 @@ #include +using std::setfill; +using std::setw; +using std::string; + static const int num_weekdays = 7; static const char * const weekdays[num_weekdays] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" @@ -245,7 +249,7 @@ get_string() const { struct tm *tp = gmtime(&_time); - ostringstream result; + std::ostringstream result; result << weekdays[tp->tm_wday] << ", " << setw(2) << setfill('0') << tp->tm_mday << " " @@ -263,7 +267,7 @@ get_string() const { * */ bool HTTPDate:: -input(istream &in) { +input(std::istream &in) { (*this) = HTTPDate(); // Extract out the quoted date string. @@ -294,7 +298,7 @@ input(istream &in) { * */ void HTTPDate:: -output(ostream &out) const { +output(std::ostream &out) const { // We put quotes around the string on output, so we can reliably detect the // end of the date string on input, above. out << '"' << get_string() << '"'; diff --git a/panda/src/downloader/httpDigestAuthorization.cxx b/panda/src/downloader/httpDigestAuthorization.cxx index 8bb2804bcf..1e59ea560c 100644 --- a/panda/src/downloader/httpDigestAuthorization.cxx +++ b/panda/src/downloader/httpDigestAuthorization.cxx @@ -21,6 +21,10 @@ #include "openssl/md5.h" #include +using std::ostream; +using std::ostringstream; +using std::string; + const string HTTPDigestAuthorization::_mechanism = "digest"; /** @@ -277,7 +281,7 @@ get_a2(HTTPEnum::Method method, const string &request_path, string HTTPDigestAuthorization:: get_hex_nonce_count() const { ostringstream strm; - strm << hex << setfill('0') << setw(8) << _nonce_count; + strm << std::hex << std::setfill('0') << std::setw(8) << _nonce_count; return strm.str(); } diff --git a/panda/src/downloader/httpEntityTag.cxx b/panda/src/downloader/httpEntityTag.cxx index 9c756024ee..1d4b79922a 100644 --- a/panda/src/downloader/httpEntityTag.cxx +++ b/panda/src/downloader/httpEntityTag.cxx @@ -13,6 +13,8 @@ #include "httpEntityTag.h" +using std::string; + /** * This constructor accepts a string as formatted from an HTTP server (e.g. @@ -52,7 +54,7 @@ HTTPEntityTag(const string &text) { */ string HTTPEntityTag:: get_string() const { - ostringstream result; + std::ostringstream result; if (_weak) { result << "W/"; } diff --git a/panda/src/downloader/httpEnum.cxx b/panda/src/downloader/httpEnum.cxx index 1ef09de254..ebe7914110 100644 --- a/panda/src/downloader/httpEnum.cxx +++ b/panda/src/downloader/httpEnum.cxx @@ -18,8 +18,8 @@ /** * */ -ostream & -operator << (ostream &out, HTTPEnum::Method method) { +std::ostream & +operator << (std::ostream &out, HTTPEnum::Method method) { switch (method) { case HTTPEnum::M_options: out << "OPTIONS"; diff --git a/panda/src/downloader/identityStreamBuf.cxx b/panda/src/downloader/identityStreamBuf.cxx index 4d98540423..852c252f32 100644 --- a/panda/src/downloader/identityStreamBuf.cxx +++ b/panda/src/downloader/identityStreamBuf.cxx @@ -140,7 +140,7 @@ read_chars(char *start, size_t length) { // content_length restriction. if (_bytes_remaining != 0) { - length = min(length, _bytes_remaining); + length = std::min(length, _bytes_remaining); (*_source)->read(start, length); read_count = (*_source)->gcount(); if (!_wanted_nonblocking) { diff --git a/panda/src/downloader/multiplexStreamBuf.cxx b/panda/src/downloader/multiplexStreamBuf.cxx index 3b6b0a8b10..aa42d33f9e 100644 --- a/panda/src/downloader/multiplexStreamBuf.cxx +++ b/panda/src/downloader/multiplexStreamBuf.cxx @@ -24,6 +24,8 @@ // recursion. #include +using std::string; + /** * Closes or deletes the relevant pointers, if _owns_obj is true. */ @@ -107,7 +109,7 @@ MultiplexStreamBuf:: void MultiplexStreamBuf:: add_output(MultiplexStreamBuf::BufferType buffer_type, MultiplexStreamBuf::OutputType output_type, - ostream *out, FILE *fout, bool owns_obj) { + std::ostream *out, FILE *fout, bool owns_obj) { Output o; o._buffer_type = buffer_type; @@ -141,7 +143,7 @@ int MultiplexStreamBuf:: overflow(int ch) { _lock.lock(); - streamsize n = pptr() - pbase(); + std::streamsize n = pptr() - pbase(); if (n != 0) { write_chars(pbase(), n, false); @@ -166,7 +168,7 @@ int MultiplexStreamBuf:: sync() { _lock.lock(); - streamsize n = pptr() - pbase(); + std::streamsize n = pptr() - pbase(); // We pass in false for the flush value, even though our transmitting // ostream said to sync. This allows us to get better line buffering, since diff --git a/panda/src/downloader/socketStream.cxx b/panda/src/downloader/socketStream.cxx index 4d52a82cb5..eec65d1857 100644 --- a/panda/src/downloader/socketStream.cxx +++ b/panda/src/downloader/socketStream.cxx @@ -23,7 +23,7 @@ * */ SSReader:: -SSReader(istream *stream) : _istream(stream) { +SSReader(std::istream *stream) : _istream(stream) { _data_expected = 0; _tcp_header_size = tcp_header_size; @@ -84,13 +84,13 @@ do_receive_datagram(Datagram &dg) { static const size_t buffer_size = 1024; char buffer[buffer_size]; - size_t read_count = min(_data_expected - _data_so_far.size(), buffer_size); + size_t read_count = std::min(_data_expected - _data_so_far.size(), buffer_size); _istream->read(buffer, read_count); size_t count = _istream->gcount(); while (count != 0) { _data_so_far.insert(_data_so_far.end(), buffer, buffer + count); - read_count = min(_data_expected - _data_so_far.size(), + read_count = std::min(_data_expected - _data_so_far.size(), buffer_size); _istream->read(buffer, read_count); count = _istream->gcount(); @@ -126,7 +126,7 @@ do_receive_datagram(Datagram &dg) { void SSReader:: start_delay(double min_delay, double max_delay) { _min_delay = min_delay; - _delay_variance = max(max_delay - min_delay, 0.0); + _delay_variance = std::max(max_delay - min_delay, 0.0); _delay_active = true; } #endif // SIMULATE_NETWORK_DELAY @@ -194,7 +194,7 @@ get_delayed(Datagram &datagram) { * */ SSWriter:: -SSWriter(ostream *stream) : _ostream(stream) { +SSWriter(std::ostream *stream) : _ostream(stream) { _collect_tcp = collect_tcp; _collect_tcp_interval = collect_tcp_interval; _queued_data_start = 0.0; diff --git a/panda/src/downloader/stringStreamBuf.cxx b/panda/src/downloader/stringStreamBuf.cxx index 4067ca1acb..f9a6cc99f9 100644 --- a/panda/src/downloader/stringStreamBuf.cxx +++ b/panda/src/downloader/stringStreamBuf.cxx @@ -15,6 +15,10 @@ #include "pnotify.h" #include "config_express.h" +using std::ios; +using std::streamoff; +using std::streampos; + /** * */ @@ -82,7 +86,7 @@ read_chars(char *start, size_t length) { return 0; } - length = min(length, _data.size() - _gpos); + length = std::min(length, _data.size() - _gpos); memcpy(start, &_data[_gpos], length); _gpos += length; return length; @@ -102,7 +106,7 @@ write_chars(const char *start, size_t length) { if (_data.size() > _ppos) { // We are overwriting some data. size_t remaining_length = _data.size() - _ppos; - size_t overwrite_length = min(remaining_length, length); + size_t overwrite_length = std::min(remaining_length, length); memcpy(&_data[_ppos], start, overwrite_length); length -= overwrite_length; _ppos += overwrite_length; diff --git a/panda/src/downloader/urlSpec.cxx b/panda/src/downloader/urlSpec.cxx index 09769f3693..1925c6a775 100644 --- a/panda/src/downloader/urlSpec.cxx +++ b/panda/src/downloader/urlSpec.cxx @@ -17,6 +17,13 @@ #include +using std::istream; +using std::ostream; +using std::ostringstream; +using std::setfill; +using std::setw; +using std::string; + /** * */ @@ -711,7 +718,7 @@ output(ostream &out) const { string URLSpec:: quote(const string &source, const string &safe) { ostringstream result; - result << hex << setfill('0'); + result << std::hex << setfill('0'); for (string::const_iterator si = source.begin(); si != source.end(); ++si) { char ch = (*si); @@ -750,7 +757,7 @@ quote(const string &source, const string &safe) { string URLSpec:: quote_plus(const string &source, const string &safe) { ostringstream result; - result << hex << setfill('0'); + result << std::hex << setfill('0'); for (string::const_iterator si = source.begin(); si != source.end(); ++si) { char ch = (*si); diff --git a/panda/src/downloader/virtualFileHTTP.cxx b/panda/src/downloader/virtualFileHTTP.cxx index 27f33c644a..527e9c619b 100644 --- a/panda/src/downloader/virtualFileHTTP.cxx +++ b/panda/src/downloader/virtualFileHTTP.cxx @@ -18,6 +18,10 @@ #ifdef HAVE_OPENSSL +using std::istream; +using std::ostream; +using std::string; + TypeHandle VirtualFileHTTP::_type_handle; @@ -205,7 +209,7 @@ was_read_successful() const { * file. Pass in the stream that was returned by open_read_file(); some * implementations may require this stream to determine the size. */ -streamsize VirtualFileHTTP:: +std::streamsize VirtualFileHTTP:: get_file_size(istream *stream) const { return _channel->get_file_size(); } @@ -214,7 +218,7 @@ get_file_size(istream *stream) const { * Returns the current size on disk (or wherever it is) of the file before it * has been opened. */ -streamsize VirtualFileHTTP:: +std::streamsize VirtualFileHTTP:: get_file_size() const { return _channel->get_file_size(); } diff --git a/panda/src/downloader/virtualFileMountHTTP.cxx b/panda/src/downloader/virtualFileMountHTTP.cxx index c9cc4759a0..25e9dc99ea 100644 --- a/panda/src/downloader/virtualFileMountHTTP.cxx +++ b/panda/src/downloader/virtualFileMountHTTP.cxx @@ -17,6 +17,8 @@ #ifdef HAVE_OPENSSL +using std::string; + TypeHandle VirtualFileMountHTTP::_type_handle; @@ -174,7 +176,7 @@ make_virtual_file(const Filename &local_filename, * istream on success (which you should eventually delete when you are done * reading). Returns NULL on failure. */ -istream *VirtualFileMountHTTP:: +std::istream *VirtualFileMountHTTP:: open_read_file(const Filename &) const { return nullptr; } @@ -184,8 +186,8 @@ open_read_file(const Filename &) const { * file. Pass in the stream that was returned by open_read_file(); some * implementations may require this stream to determine the size. */ -streamsize VirtualFileMountHTTP:: -get_file_size(const Filename &, istream *) const { +std::streamsize VirtualFileMountHTTP:: +get_file_size(const Filename &, std::istream *) const { return 0; } @@ -193,7 +195,7 @@ get_file_size(const Filename &, istream *) const { * Returns the current size on disk (or wherever it is) of the file before it * has been opened. */ -streamsize VirtualFileMountHTTP:: +std::streamsize VirtualFileMountHTTP:: get_file_size(const Filename &) const { return 0; } @@ -227,7 +229,7 @@ scan_directory(vector_string &, const Filename &) const { * */ void VirtualFileMountHTTP:: -output(ostream &out) const { +output(std::ostream &out) const { out << _root; } diff --git a/panda/src/downloadertools/apply_patch.cxx b/panda/src/downloadertools/apply_patch.cxx index 908f3c8189..502d67c89b 100644 --- a/panda/src/downloadertools/apply_patch.cxx +++ b/panda/src/downloadertools/apply_patch.cxx @@ -15,6 +15,9 @@ #include "patchfile.h" #include "filename.h" +using std::cerr; +using std::endl; + int main(int argc, char **argv) { preprocess_argv(argc, argv); diff --git a/panda/src/downloadertools/build_patch.cxx b/panda/src/downloadertools/build_patch.cxx index d14e27db9f..5c705bb38d 100644 --- a/panda/src/downloadertools/build_patch.cxx +++ b/panda/src/downloadertools/build_patch.cxx @@ -15,6 +15,9 @@ #include "patchfile.h" #include "filename.h" +using std::cerr; +using std::endl; + void usage() { cerr << "Usage: build_patch [opts] " << endl; diff --git a/panda/src/downloadertools/check_adler.cxx b/panda/src/downloadertools/check_adler.cxx index b53eb2839f..dbea94f8b7 100644 --- a/panda/src/downloadertools/check_adler.cxx +++ b/panda/src/downloadertools/check_adler.cxx @@ -14,13 +14,13 @@ int main(int argc, char *argv[]) { if (argc < 2) { - cerr << "Usage: check_adler " << endl; + std::cerr << "Usage: check_adler " << std::endl; return 1; } Filename source_file = argv[1]; - cout << check_adler(source_file); + std::cout << check_adler(source_file); return 0; } diff --git a/panda/src/downloadertools/check_crc.cxx b/panda/src/downloadertools/check_crc.cxx index 9afadd4fb2..e98de20b57 100644 --- a/panda/src/downloadertools/check_crc.cxx +++ b/panda/src/downloadertools/check_crc.cxx @@ -14,13 +14,13 @@ int main(int argc, char *argv[]) { if (argc < 2) { - cerr << "Usage: check_crc " << endl; + std::cerr << "Usage: check_crc " << std::endl; return 1; } Filename source_file = argv[1]; - cout << check_crc(source_file); + std::cout << check_crc(source_file); return 0; } diff --git a/panda/src/downloadertools/check_md5.cxx b/panda/src/downloadertools/check_md5.cxx index 5b386c7c1e..2cc3ce508e 100644 --- a/panda/src/downloadertools/check_md5.cxx +++ b/panda/src/downloadertools/check_md5.cxx @@ -15,6 +15,9 @@ #include "panda_getopt.h" #include "preprocess_argv.h" +using std::cerr; +using std::cout; + bool output_decimal = false; bool suppress_filename = false; pofstream binary_output; @@ -45,7 +48,7 @@ help() { } void -output_hash(const string &filename, const HashVal &hash) { +output_hash(const std::string &filename, const HashVal &hash) { if (!suppress_filename && !filename.empty()) { cout << filename << " "; } @@ -69,7 +72,7 @@ main(int argc, char **argv) { const char *optstr = "i:db:qh"; bool got_input_string = false; - string input_string; + std::string input_string; Filename binary_output_filename; preprocess_argv(argc, argv); @@ -87,7 +90,7 @@ main(int argc, char **argv) { break; case 'b': - binary_output_filename = Filename::binary_filename(string(optarg)); + binary_output_filename = Filename::binary_filename(std::string(optarg)); break; case 'q': diff --git a/panda/src/downloadertools/multify.cxx b/panda/src/downloadertools/multify.cxx index 3b58ca0d23..bea4c5bedd 100644 --- a/panda/src/downloadertools/multify.cxx +++ b/panda/src/downloadertools/multify.cxx @@ -21,6 +21,11 @@ #include #include +using std::cerr; +using std::cout; +using std::endl; +using std::string; + bool create = false; // -c bool append = false; // -r @@ -634,7 +639,7 @@ list_files(const vector_string ¶ms) { // We happen to know that we can read the index without doing a seek. // So this is the only place where we accept a .pz/.gz compressed .mf. VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr(); - istream *istr = vfs->open_read_file(multifile_name, true); + std::istream *istr = vfs->open_read_file(multifile_name, true); if (istr == nullptr) { cerr << "Unable to open " << multifile_name << " for reading.\n"; return false; diff --git a/panda/src/downloadertools/pdecrypt.cxx b/panda/src/downloadertools/pdecrypt.cxx index 9ce3445bf0..7763286b09 100644 --- a/panda/src/downloadertools/pdecrypt.cxx +++ b/panda/src/downloadertools/pdecrypt.cxx @@ -17,7 +17,10 @@ #include "panda_getopt.h" #include "preprocess_argv.h" -string password; +using std::cerr; +using std::endl; + +std::string password; bool got_password = false; void diff --git a/panda/src/downloadertools/pencrypt.cxx b/panda/src/downloadertools/pencrypt.cxx index 3d61651348..e40fbaba2c 100644 --- a/panda/src/downloadertools/pencrypt.cxx +++ b/panda/src/downloadertools/pencrypt.cxx @@ -17,9 +17,12 @@ #include "panda_getopt.h" #include "preprocess_argv.h" -string password; +using std::cerr; +using std::endl; + +std::string password; bool got_password = false; -string algorithm; +std::string algorithm; bool got_algorithm = false; int key_length = -1; bool got_key_length = false; diff --git a/panda/src/downloadertools/punzip.cxx b/panda/src/downloadertools/punzip.cxx index 5753f7b6ec..84a593c795 100644 --- a/panda/src/downloadertools/punzip.cxx +++ b/panda/src/downloadertools/punzip.cxx @@ -15,6 +15,11 @@ #include "panda_getopt.h" #include "preprocess_argv.h" +using std::cerr; +using std::cin; +using std::cout; +using std::endl; + void usage() { cerr diff --git a/panda/src/downloadertools/pzip.cxx b/panda/src/downloadertools/pzip.cxx index 6364be0130..37c80e7f9f 100644 --- a/panda/src/downloadertools/pzip.cxx +++ b/panda/src/downloadertools/pzip.cxx @@ -15,6 +15,11 @@ #include "panda_getopt.h" #include "preprocess_argv.h" +using std::cerr; +using std::cin; +using std::cout; +using std::endl; + void usage() { cerr diff --git a/panda/src/downloadertools/show_ddb.cxx b/panda/src/downloadertools/show_ddb.cxx index d19c3be9cd..1b1a4abce4 100644 --- a/panda/src/downloadertools/show_ddb.cxx +++ b/panda/src/downloadertools/show_ddb.cxx @@ -18,7 +18,7 @@ int main(int argc, char *argv[]) { if (argc != 3) { - cerr << "Usage: show_ddb server.ddb client.ddb\n"; + std::cerr << "Usage: show_ddb server.ddb client.ddb\n"; return 1; } @@ -26,7 +26,7 @@ main(int argc, char *argv[]) { Filename client_ddb = Filename::from_os_specific(argv[2]); DownloadDb db(server_ddb, client_ddb); - db.write(cout); + db.write(std::cout); return 0; } diff --git a/panda/src/dxgsg9/dxGeomMunger9.cxx b/panda/src/dxgsg9/dxGeomMunger9.cxx index cce0f2e6f0..8aa539c11f 100644 --- a/panda/src/dxgsg9/dxGeomMunger9.cxx +++ b/panda/src/dxgsg9/dxGeomMunger9.cxx @@ -140,7 +140,7 @@ munge_format_impl(const GeomVertexFormat *orig, int tc_index = _filtered_texture->get_ff_tc_index(si); nassertr(tc_index < num_stages, orig); ff_tc_index[tc_index] = si; - max_tc_index = max(tc_index, max_tc_index); + max_tc_index = std::max(tc_index, max_tc_index); } // Now walk through the texture coordinates in the order they will appear @@ -243,7 +243,7 @@ premunge_format_impl(const GeomVertexFormat *orig) { int tc_index = _filtered_texture->get_ff_tc_index(si); nassertr(tc_index < num_stages, orig); ff_tc_index[tc_index] = si; - max_tc_index = max(tc_index, max_tc_index); + max_tc_index = std::max(tc_index, max_tc_index); } // Now walk through the texture coordinates in the order they will appear diff --git a/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx b/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx index 389baa4dca..0e5687d490 100644 --- a/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx +++ b/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx @@ -77,6 +77,10 @@ #define SDK_VERSION(major,minor) tostring(major) << "." << tostring(minor) #define DIRECTX_SDK_VERSION SDK_VERSION (_DXSDK_PRODUCT_MAJOR, _DXSDK_PRODUCT_MINOR) << "." << SDK_VERSION (_DXSDK_BUILD_MAJOR, _DXSDK_BUILD_MINOR) +using std::endl; +using std::max; +using std::min; + TypeHandle DXGraphicsStateGuardian9::_type_handle; D3DMATRIX DXGraphicsStateGuardian9::_d3d_ident_mat; @@ -3312,7 +3316,7 @@ bind_light(DirectionalLight *light_obj, const NodePath &light, int light_id) { static PStatCollector _draw_set_state_light_bind_directional_pcollector("Draw:Set State:Light:Bind:Directional"); // PStatTimer timer(_draw_set_state_light_bind_directional_pcollector); - pair lookup = _dlights.insert(DirectionalLights::value_type(light, D3DLIGHT9())); + std::pair lookup = _dlights.insert(DirectionalLights::value_type(light, D3DLIGHT9())); D3DLIGHT9 &fdata = (*lookup.first).second; if (lookup.second) { // Get the light in "world coordinates" (actually, view coordinates). @@ -4548,7 +4552,7 @@ reset_d3d_device(D3DPRESENT_PARAMETERS *presentation_params, // release graphics buffer surfaces { wdxGraphicsBuffer9 *graphics_buffer; - list ::iterator graphics_buffer_iterator; + std::list ::iterator graphics_buffer_iterator; for (graphics_buffer_iterator = _graphics_buffer_list.begin( ); graphics_buffer_iterator != _graphics_buffer_list.end( ); graphics_buffer_iterator++) { @@ -5372,7 +5376,7 @@ atexit_function(void) { * Profile. */ bool DXGraphicsStateGuardian9:: -get_supports_cg_profile(const string &name) const { +get_supports_cg_profile(const std::string &name) const { #ifndef HAVE_CG return false; #else @@ -5400,7 +5404,7 @@ set_cg_device(LPDIRECT3DDEVICE9 cg_device) { #endif // HAVE_CG } -typedef string KEY; +typedef std::string KEY; typedef struct _KEY_ELEMENT { diff --git a/panda/src/dxgsg9/dxInput9.cxx b/panda/src/dxgsg9/dxInput9.cxx index d0556d44c7..17d5b2f88e 100644 --- a/panda/src/dxgsg9/dxInput9.cxx +++ b/panda/src/dxgsg9/dxInput9.cxx @@ -17,6 +17,8 @@ #define AXIS_RESOLUTION 2000 // use this many levels of resolution by default (could be more if needed and device supported it) #define AXIS_RANGE_CENTERED // if defined, axis range is centered on 0, instead of starting on 0 +using std::endl; + BOOL CALLBACK EnumGameCtrlsCallback( const DIDEVICEINSTANCE* pdidInstance, VOID* pContext ) { DI_DeviceInfos *pDevInfos = (DI_DeviceInfos *)pContext; diff --git a/panda/src/dxgsg9/dxShaderContext9.cxx b/panda/src/dxgsg9/dxShaderContext9.cxx index c3b1970bd9..6513ce8a89 100644 --- a/panda/src/dxgsg9/dxShaderContext9.cxx +++ b/panda/src/dxgsg9/dxShaderContext9.cxx @@ -207,7 +207,7 @@ issue_parameters(GSG *gsg, int altered) { // Calculate how many elements to transfer; no more than it expects, // but certainly no more than we have. - int input_size = min(abs(spec._dim[0] * spec._dim[1] * spec._dim[2]), (int)ptr_data->_size); + int input_size = std::min(abs(spec._dim[0] * spec._dim[1] * spec._dim[2]), (int)ptr_data->_size); CGparameter p = _cg_parameter_map[spec._id._seqno]; switch (ptr_data->_type) { @@ -313,7 +313,7 @@ issue_parameters(GSG *gsg, int altered) { } if (FAILED(hr)) { - string name = "unnamed"; + std::string name = "unnamed"; if (spec._arg[0]) { name = spec._arg[0]->get_basename(); diff --git a/panda/src/dxgsg9/dxTextureContext9.cxx b/panda/src/dxgsg9/dxTextureContext9.cxx index 12ad6dfdfe..70c9db7803 100644 --- a/panda/src/dxgsg9/dxTextureContext9.cxx +++ b/panda/src/dxgsg9/dxTextureContext9.cxx @@ -24,6 +24,10 @@ #define DEBUG_SURFACES false #define DEBUG_TEXTURES true +using std::endl; +using std::max; +using std::min; + TypeHandle DXTextureContext9::_type_handle; static const DWORD g_LowByteMask = 0x000000FF; @@ -686,7 +690,7 @@ create_texture(DXScreenData &scrn) { << "NumColorChannels: " << num_color_channels << "; NumAlphaBits: " << num_alpha_bits << "; targetbpp: " <::iterator graphics_buffer_iterator; + std::list ::iterator graphics_buffer_iterator; graphics_buffer_iterator = _shared_depth_buffer_list.begin( ); while (graphics_buffer_iterator != _shared_depth_buffer_list.end( )) { diff --git a/panda/src/dxgsg9/wdxGraphicsPipe9.cxx b/panda/src/dxgsg9/wdxGraphicsPipe9.cxx index 7ff6f28e5d..cbfada1b41 100644 --- a/panda/src/dxgsg9/wdxGraphicsPipe9.cxx +++ b/panda/src/dxgsg9/wdxGraphicsPipe9.cxx @@ -17,6 +17,8 @@ #include "wdxGraphicsBuffer9.h" #include "config_dxgsg9.h" +using std::endl; + TypeHandle wdxGraphicsPipe9::_type_handle; static bool MyGetProcAddr(HINSTANCE hDLL, FARPROC *pFn, const char *szExportedFnName) { @@ -60,7 +62,7 @@ wdxGraphicsPipe9:: * choose between several possible GraphicsPipes available on a particular * platform, so the name should be meaningful and unique for a given platform. */ -string wdxGraphicsPipe9:: +std::string wdxGraphicsPipe9:: get_interface_name() const { return "DirectX9"; } @@ -78,7 +80,7 @@ pipe_constructor() { * Creates a new window on the pipe, if possible. */ PT(GraphicsOutput) wdxGraphicsPipe9:: -make_output(const string &name, +make_output(const std::string &name, const FrameBufferProperties &fb_prop, const WindowProperties &win_prop, int flags, diff --git a/panda/src/dxgsg9/wdxGraphicsWindow9.cxx b/panda/src/dxgsg9/wdxGraphicsWindow9.cxx index d173881ac0..3136d75fd0 100644 --- a/panda/src/dxgsg9/wdxGraphicsWindow9.cxx +++ b/panda/src/dxgsg9/wdxGraphicsWindow9.cxx @@ -26,6 +26,8 @@ #include #include +using std::endl; + TypeHandle wdxGraphicsWindow9::_type_handle; /** @@ -33,7 +35,7 @@ TypeHandle wdxGraphicsWindow9::_type_handle; */ wdxGraphicsWindow9:: wdxGraphicsWindow9(GraphicsEngine *engine, GraphicsPipe *pipe, - const string &name, + const std::string &name, const FrameBufferProperties &fb_prop, const WindowProperties &win_prop, int flags, @@ -880,10 +882,10 @@ choose_device() { << ", Driver: " << adapter_info.Driver << ", DriverVersion: (" << HIWORD(DrvVer->HighPart) << "." << LOWORD(DrvVer->HighPart) << "." << HIWORD(DrvVer->LowPart) << "." << LOWORD(DrvVer->LowPart) - << ")\nVendorID: 0x" << hex << adapter_info.VendorId + << ")\nVendorID: 0x" << std::hex << adapter_info.VendorId << " DeviceID: 0x" << adapter_info.DeviceId << " SubsysID: 0x" << adapter_info.SubSysId - << " Revision: 0x" << adapter_info.Revision << dec << endl; + << " Revision: 0x" << adapter_info.Revision << std::dec << endl; HMONITOR _monitor = dxpipe->__d3d9->GetAdapterMonitor(i); if (_monitor == nullptr) { diff --git a/panda/src/dxml/config_dxml.cxx b/panda/src/dxml/config_dxml.cxx index 9c9a65533b..0441f1fdc5 100644 --- a/panda/src/dxml/config_dxml.cxx +++ b/panda/src/dxml/config_dxml.cxx @@ -54,7 +54,7 @@ BEGIN_PUBLISH // Returns the document, or NULL on error. //////////////////////////////////////////////////////////////////// TiXmlDocument * -read_xml_stream(istream &in) { +read_xml_stream(std::istream &in) { TiXmlDocument *doc = new TiXmlDocument; in >> *doc; if (in.fail() && !in.eof()) { @@ -72,7 +72,7 @@ BEGIN_PUBLISH // Description: Writes an XML document to the indicated stream. //////////////////////////////////////////////////////////////////// void -write_xml_stream(ostream &out, TiXmlDocument *doc) { +write_xml_stream(std::ostream &out, TiXmlDocument *doc) { out << *doc; } END_PUBLISH @@ -97,7 +97,7 @@ BEGIN_PUBLISH //////////////////////////////////////////////////////////////////// void print_xml_to_file(const Filename &filename, TiXmlNode *xnode) { - string os_name = filename.to_os_specific(); + std::string os_name = filename.to_os_specific(); #ifdef _WIN32 FILE *file; if (fopen_s(&file, os_name.c_str(), "w") != 0) { diff --git a/panda/src/egg/eggAnimPreload.cxx b/panda/src/egg/eggAnimPreload.cxx index ff05b12a3c..894df329ce 100644 --- a/panda/src/egg/eggAnimPreload.cxx +++ b/panda/src/egg/eggAnimPreload.cxx @@ -23,7 +23,7 @@ TypeHandle EggAnimPreload::_type_handle; * Egg format. */ void EggAnimPreload:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { test_under_integrity(); write_header(out, indent_level, ""); diff --git a/panda/src/egg/eggAttributes.cxx b/panda/src/egg/eggAttributes.cxx index 4f27c5a8b3..26fe007524 100644 --- a/panda/src/egg/eggAttributes.cxx +++ b/panda/src/egg/eggAttributes.cxx @@ -62,7 +62,7 @@ EggAttributes:: * Writes the attributes to the indicated output stream in Egg format. */ void EggAttributes:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { if (has_normal()) { if (_dnormals.empty()) { indent(out, indent_level) diff --git a/panda/src/egg/eggBin.cxx b/panda/src/egg/eggBin.cxx index 789eaffb21..95a8bdc0a9 100644 --- a/panda/src/egg/eggBin.cxx +++ b/panda/src/egg/eggBin.cxx @@ -21,7 +21,7 @@ TypeHandle EggBin::_type_handle; * */ EggBin:: -EggBin(const string &name) : EggGroup(name) { +EggBin(const std::string &name) : EggGroup(name) { _bin_number = 0; } diff --git a/panda/src/egg/eggBinMaker.cxx b/panda/src/egg/eggBinMaker.cxx index 9200afde6b..4c0214eb92 100644 --- a/panda/src/egg/eggBinMaker.cxx +++ b/panda/src/egg/eggBinMaker.cxx @@ -112,9 +112,9 @@ collapse_group(const EggGroup *, int) { * May be overridden in derived classes to define a name for each new bin, * based on its bin number, and a sample child. */ -string EggBinMaker:: +std::string EggBinMaker:: get_bin_name(int, const EggNode *) { - return string(); + return std::string(); } /** @@ -162,7 +162,7 @@ collect_nodes(EggGroupNode *group) { // If this is the first time this group has been encountered, we need // to create a new entry in _group_nodes for it. - pair result; + std::pair result; result = _group_nodes.insert (GroupNodes::value_type (group, SortedNodes(EggBinMakerCompareNodes(this)))); @@ -286,7 +286,7 @@ setup_bin(EggBin *bin, const Nodes &nodes) { int bin_number = get_bin_number(nodes.front()); bin->set_bin_number(bin_number); - string bin_name = get_bin_name(bin_number, nodes.front()); + std::string bin_name = get_bin_name(bin_number, nodes.front()); if (!bin_name.empty()) { bin->set_name(bin_name); } diff --git a/panda/src/egg/eggComment.cxx b/panda/src/egg/eggComment.cxx index a55dd0787c..1379623c03 100644 --- a/panda/src/egg/eggComment.cxx +++ b/panda/src/egg/eggComment.cxx @@ -24,7 +24,7 @@ TypeHandle EggComment::_type_handle; * Writes the comment definition to the indicated output stream in Egg format. */ void EggComment:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { write_header(out, indent_level, ""); enquote_string(out, get_comment(), indent_level + 2) << "\n"; indent(out, indent_level) << "}\n"; diff --git a/panda/src/egg/eggCompositePrimitive.cxx b/panda/src/egg/eggCompositePrimitive.cxx index 94c4b1d625..f390fb67c2 100644 --- a/panda/src/egg/eggCompositePrimitive.cxx +++ b/panda/src/egg/eggCompositePrimitive.cxx @@ -330,7 +330,7 @@ post_apply_flat_attribute() { int num_lead_vertices = get_num_lead_vertices(); for (int i = 0; i < (int)size(); i++) { EggVertex *vertex = get_vertex(i); - EggAttributes *component = get_component(max(i - num_lead_vertices, 0)); + EggAttributes *component = get_component(std::max(i - num_lead_vertices, 0)); // Use set_normal() instead of copy_normal(), to avoid getting the // morphs--we don't want them here, since we're just putting a bogus @@ -376,7 +376,7 @@ prepare_add_vertex(EggVertex *vertex, int i, int n) { int num_lead_vertices = get_num_lead_vertices(); if (n >= num_lead_vertices + 1) { - i = max(i - num_lead_vertices, 0); + i = std::max(i - num_lead_vertices, 0); nassertv(i <= (int)_components.size()); _components.insert(_components.begin() + i, new EggAttributes(*this)); } @@ -400,7 +400,7 @@ prepare_remove_vertex(EggVertex *vertex, int i, int n) { int num_lead_vertices = get_num_lead_vertices(); if (n >= num_lead_vertices + 1) { - i = max(i - num_lead_vertices, 0); + i = std::max(i - num_lead_vertices, 0); nassertv(i < (int)_components.size()); delete _components[i]; _components.erase(_components.begin() + i); @@ -428,7 +428,7 @@ do_triangulate(EggGroupNode *container) const { * indicated output stream in Egg format. */ void EggCompositePrimitive:: -write_body(ostream &out, int indent_level) const { +write_body(std::ostream &out, int indent_level) const { EggPrimitive::write_body(out, indent_level); for (int i = 0; i < get_num_components(); i++) { diff --git a/panda/src/egg/eggCoordinateSystem.cxx b/panda/src/egg/eggCoordinateSystem.cxx index 9ef0ce14f9..a646de21c7 100644 --- a/panda/src/egg/eggCoordinateSystem.cxx +++ b/panda/src/egg/eggCoordinateSystem.cxx @@ -23,7 +23,7 @@ TypeHandle EggCoordinateSystem::_type_handle; * Egg format. */ void EggCoordinateSystem:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { if (get_value() != CS_default && get_value() != CS_invalid) { indent(out, indent_level) diff --git a/panda/src/egg/eggCurve.cxx b/panda/src/egg/eggCurve.cxx index 932e4a6c9d..1c18a9ac5e 100644 --- a/panda/src/egg/eggCurve.cxx +++ b/panda/src/egg/eggCurve.cxx @@ -25,7 +25,7 @@ TypeHandle EggCurve::_type_handle; * CurveType value. */ EggCurve::CurveType EggCurve:: -string_curve_type(const string &string) { +string_curve_type(const std::string &string) { if (cmp_nocase_uh(string, "xyz") == 0) { return CT_xyz; } else if (cmp_nocase_uh(string, "hpr") == 0) { @@ -40,7 +40,7 @@ string_curve_type(const string &string) { /** * */ -ostream &operator << (ostream &out, EggCurve::CurveType t) { +std::ostream &operator << (std::ostream &out, EggCurve::CurveType t) { switch (t) { case EggCurve::CT_none: return out << "none"; diff --git a/panda/src/egg/eggData.cxx b/panda/src/egg/eggData.cxx index 84fe2cde3c..75c9ad68d0 100644 --- a/panda/src/egg/eggData.cxx +++ b/panda/src/egg/eggData.cxx @@ -26,6 +26,9 @@ #include "lightMutexHolder.h" #include "zStream.h" +using std::istream; +using std::ostream; + extern int eggyyparse(); #include "parserDefs.h" #include "lexerDefs.h" @@ -59,7 +62,7 @@ resolve_egg_filename(Filename &egg_filename, const DSearchPath &searchpath) { * error is the output stream to which to write error messages. */ bool EggData:: -read(Filename filename, string display_name) { +read(Filename filename, std::string display_name) { filename.set_text(); set_egg_filename(filename); @@ -230,8 +233,8 @@ write_egg(ostream &out) { if (egg_precision > 0) { // Change the egg precision as requested. - streamsize orig_precision = out.precision(); - out.precision((streamsize)egg_precision); + std::streamsize orig_precision = out.precision(); + out.precision((std::streamsize)egg_precision); write(out, 0); out.precision(orig_precision); } else { diff --git a/panda/src/egg/eggExternalReference.cxx b/panda/src/egg/eggExternalReference.cxx index d70a5003db..e124e05238 100644 --- a/panda/src/egg/eggExternalReference.cxx +++ b/panda/src/egg/eggExternalReference.cxx @@ -24,7 +24,7 @@ TypeHandle EggExternalReference::_type_handle; * */ EggExternalReference:: -EggExternalReference(const string &node_name, const string &filename) +EggExternalReference(const std::string &node_name, const std::string &filename) : EggFilenameNode(node_name, filename) { } @@ -49,7 +49,7 @@ operator = (const EggExternalReference ©) { * Writes the reference to the indicated output stream in Egg format. */ void EggExternalReference:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { write_header(out, indent_level, ""); enquote_string(out, get_filename(), indent_level + 2) << "\n"; indent(out, indent_level) << "}\n"; @@ -58,7 +58,7 @@ write(ostream &out, int indent_level) const { /** * Returns the default extension for this filename type. */ -string EggExternalReference:: +std::string EggExternalReference:: get_default_extension() const { - return string("egg"); + return std::string("egg"); } diff --git a/panda/src/egg/eggFilenameNode.cxx b/panda/src/egg/eggFilenameNode.cxx index b0a257c9a4..83e26aff5f 100644 --- a/panda/src/egg/eggFilenameNode.cxx +++ b/panda/src/egg/eggFilenameNode.cxx @@ -18,7 +18,7 @@ TypeHandle EggFilenameNode::_type_handle; /** * Returns the default extension for this filename type. */ -string EggFilenameNode:: +std::string EggFilenameNode:: get_default_extension() const { - return string(); + return std::string(); } diff --git a/panda/src/egg/eggGroup.cxx b/panda/src/egg/eggGroup.cxx index b67d079cce..a5ff1dee06 100644 --- a/panda/src/egg/eggGroup.cxx +++ b/panda/src/egg/eggGroup.cxx @@ -22,6 +22,9 @@ #include "lmatrix.h" #include "dcast.h" +using std::ostream; +using std::string; + TypeHandle EggGroup::_type_handle; diff --git a/panda/src/egg/eggGroupNode.cxx b/panda/src/egg/eggGroupNode.cxx index ef31289424..851eba7f48 100644 --- a/panda/src/egg/eggGroupNode.cxx +++ b/panda/src/egg/eggGroupNode.cxx @@ -39,6 +39,8 @@ #include +using std::string; + TypeHandle EggGroupNode::_type_handle; @@ -79,7 +81,7 @@ EggGroupNode:: * Egg format. */ void EggGroupNode:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { iterator i; // Since joints tend to reference vertex pools, which sometimes appear later @@ -738,7 +740,7 @@ triangulate_polygons(int flags) { } } - num_produced += max(0, (int)(_children.size() - children_copy.size())); + num_produced += std::max(0, (int)(_children.size() - children_copy.size())); return num_produced; } diff --git a/panda/src/egg/eggGroupUniquifier.cxx b/panda/src/egg/eggGroupUniquifier.cxx index f19b15e10d..b43529a092 100644 --- a/panda/src/egg/eggGroupUniquifier.cxx +++ b/panda/src/egg/eggGroupUniquifier.cxx @@ -18,6 +18,8 @@ #include +using std::string; + TypeHandle EggGroupUniquifier::_type_handle; @@ -95,7 +97,7 @@ filter_name(EggNode *node) { */ string EggGroupUniquifier:: generate_name(EggNode *node, const string &category, int index) { - ostringstream str; + std::ostringstream str; str << node->get_name() << "_group" << index; return str.str(); } diff --git a/panda/src/egg/eggLine.cxx b/panda/src/egg/eggLine.cxx index fca1efd7f1..6ba445a5c8 100644 --- a/panda/src/egg/eggLine.cxx +++ b/panda/src/egg/eggLine.cxx @@ -37,7 +37,7 @@ make_copy() const { * Writes the point to the indicated output stream in Egg format. */ void EggLine:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { write_header(out, indent_level, ""); if (has_thick()) { diff --git a/panda/src/egg/eggMaterial.cxx b/panda/src/egg/eggMaterial.cxx index 8a77c9c0cc..3d543645a1 100644 --- a/panda/src/egg/eggMaterial.cxx +++ b/panda/src/egg/eggMaterial.cxx @@ -22,7 +22,7 @@ TypeHandle EggMaterial::_type_handle; * */ EggMaterial:: -EggMaterial(const string &mref_name) +EggMaterial(const std::string &mref_name) : EggNode(mref_name) { _flags = 0; @@ -54,7 +54,7 @@ EggMaterial(const EggMaterial ©) * format. */ void EggMaterial:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { write_header(out, indent_level, ""); if (has_base()) { diff --git a/panda/src/egg/eggMaterialCollection.cxx b/panda/src/egg/eggMaterialCollection.cxx index 3ccc9c330f..527bd7a0a6 100644 --- a/panda/src/egg/eggMaterialCollection.cxx +++ b/panda/src/egg/eggMaterialCollection.cxx @@ -221,7 +221,7 @@ collapse_equivalent_materials(int eq, EggMaterialCollection::MaterialReplacement ++oti) { EggMaterial *tex = (*oti); - pair result = collapser.insert(tex); + std::pair result = collapser.insert(tex); if (!result.second) { // This material is non-unique; another one was already there. EggMaterial *first = *(result.first); @@ -383,7 +383,7 @@ create_unique_material(const EggMaterial ©, int eq) { * matches. */ EggMaterial *EggMaterialCollection:: -find_mref(const string &mref_name) const { +find_mref(const std::string &mref_name) const { // This requires a complete linear traversal, not terribly efficient. OrderedMaterials::const_iterator oti; for (oti = _ordered_materials.begin(); diff --git a/panda/src/egg/eggMesher.cxx b/panda/src/egg/eggMesher.cxx index 89261d9855..da2334cfaa 100644 --- a/panda/src/egg/eggMesher.cxx +++ b/panda/src/egg/eggMesher.cxx @@ -113,7 +113,7 @@ mesh(EggGroupNode *group, bool flat_shaded) { * */ void EggMesher:: -write(ostream &out) const { +write(std::ostream &out) const { /* out << _edges.size() << " edges:\n"; copy(_edges.begin(), _edges.end(), ostream_iterator(out, "\n")); @@ -704,8 +704,8 @@ make_quads() { // and pair them up right away. The others we'll get to later. This way, // the uncertain matches won't pollute the quad alignment for everyone else. - typedef pair Pair; - typedef pair Matched; + typedef std::pair Pair; + typedef std::pair Matched; typedef pvector SoulMates; SoulMates soulmates; diff --git a/panda/src/egg/eggMesherEdge.cxx b/panda/src/egg/eggMesherEdge.cxx index 1b24891b4e..f270b30de8 100644 --- a/panda/src/egg/eggMesherEdge.cxx +++ b/panda/src/egg/eggMesherEdge.cxx @@ -52,7 +52,7 @@ change_strip(EggMesherStrip *from, EggMesherStrip *to) { * Formats the edge for output in some sensible way. */ void EggMesherEdge:: -output(ostream &out) const { +output(std::ostream &out) const { out << "Edge [" << _vi_a << " to " << _vi_b << "], " << _strips.size() << " strips:"; diff --git a/panda/src/egg/eggMesherFanMaker.cxx b/panda/src/egg/eggMesherFanMaker.cxx index 51396dd32e..09f91e0f0f 100644 --- a/panda/src/egg/eggMesherFanMaker.cxx +++ b/panda/src/egg/eggMesherFanMaker.cxx @@ -326,7 +326,7 @@ unroll(Strips::iterator strip_begin, Strips::iterator strip_end, * */ void EggMesherFanMaker:: -output(ostream &out) const { +output(std::ostream &out) const { out << _vertex << ":["; if (!_edges.empty()) { Edges::const_iterator ei; diff --git a/panda/src/egg/eggMesherStrip.cxx b/panda/src/egg/eggMesherStrip.cxx index cec01dfe36..27260b96b0 100644 --- a/panda/src/egg/eggMesherStrip.cxx +++ b/panda/src/egg/eggMesherStrip.cxx @@ -849,7 +849,7 @@ count_neighbors() const { * Writes all the neighbor indexes to the ostream. */ void EggMesherStrip:: -output_neighbors(ostream &out) const { +output_neighbors(std::ostream &out) const { Edges::const_iterator ei; EggMesherEdge::Strips::const_iterator si; @@ -1350,7 +1350,7 @@ pick_sheet_mate(const EggMesherStrip &a_strip, * Formats the vertex for output in some sensible way. */ void EggMesherStrip:: -output(ostream &out) const { +output(std::ostream &out) const { switch (_status) { case MS_alive: break; diff --git a/panda/src/egg/eggMiscFuncs.cxx b/panda/src/egg/eggMiscFuncs.cxx index 2181622df5..11d684a185 100644 --- a/panda/src/egg/eggMiscFuncs.cxx +++ b/panda/src/egg/eggMiscFuncs.cxx @@ -17,6 +17,9 @@ #include +using std::ostream; +using std::string; + /** * Writes the string to the indicated output stream. If the string contains diff --git a/panda/src/egg/eggNameUniquifier.cxx b/panda/src/egg/eggNameUniquifier.cxx index 34a7123d48..239a2b692b 100644 --- a/panda/src/egg/eggNameUniquifier.cxx +++ b/panda/src/egg/eggNameUniquifier.cxx @@ -19,6 +19,8 @@ #include "pnotify.h" +using std::string; + TypeHandle EggNameUniquifier::_type_handle; @@ -173,7 +175,7 @@ string EggNameUniquifier:: generate_name(EggNode *node, const string &category, int index) { string name = filter_name(node); - ostringstream str; + std::ostringstream str; if (name.empty()) { str << category << index; } else { diff --git a/panda/src/egg/eggNamedObject.cxx b/panda/src/egg/eggNamedObject.cxx index 663cfc3ed6..d397e26f91 100644 --- a/panda/src/egg/eggNamedObject.cxx +++ b/panda/src/egg/eggNamedObject.cxx @@ -22,7 +22,7 @@ TypeHandle EggNamedObject::_type_handle; * */ void EggNamedObject:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type(); if (has_name()) { out << " " << get_name(); @@ -36,7 +36,7 @@ output(ostream &out) const { * "". */ void EggNamedObject:: -write_header(ostream &out, int indent_level, const char *egg_keyword) const { +write_header(std::ostream &out, int indent_level, const char *egg_keyword) const { indent(out, indent_level) << egg_keyword << " "; if (has_name()) { diff --git a/panda/src/egg/eggNode.cxx b/panda/src/egg/eggNode.cxx index 531f57f2c0..efca0825c7 100644 --- a/panda/src/egg/eggNode.cxx +++ b/panda/src/egg/eggNode.cxx @@ -34,9 +34,9 @@ int EggNode:: rename_node(vector_string strip_prefix) { int num_renamed = 0; for (unsigned int ni = 0; ni < strip_prefix.size(); ++ni) { - string axe_name = strip_prefix[ni]; + std::string axe_name = strip_prefix[ni]; if (this->get_name().substr(0, axe_name.size()) == axe_name) { - string new_name = this->get_name().substr(axe_name.size()); + std::string new_name = this->get_name().substr(axe_name.size()); // cout << "renaming " << this->get_name() << "->" << new_name << endl; this->set_name(new_name); num_renamed += 1; @@ -221,13 +221,13 @@ determine_decal() { * error or if the object does not support this functionality. */ bool EggNode:: -parse_egg(const string &egg_syntax) { +parse_egg(const std::string &egg_syntax) { EggGroupNode *group = get_parent(); if (is_of_type(EggGroupNode::get_class_type())) { DCAST_INTO_R(group, this, false); } - istringstream in(egg_syntax); + std::istringstream in(egg_syntax); LightMutexHolder holder(egg_lock); diff --git a/panda/src/egg/eggNurbsCurve.cxx b/panda/src/egg/eggNurbsCurve.cxx index 79b1d5011b..f0f18a41b5 100644 --- a/panda/src/egg/eggNurbsCurve.cxx +++ b/panda/src/egg/eggNurbsCurve.cxx @@ -118,7 +118,7 @@ is_closed() const { * Writes the nurbsCurve to the indicated output stream in Egg format. */ void EggNurbsCurve:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { write_header(out, indent_level, ""); if (get_curve_type() != CT_none) { diff --git a/panda/src/egg/eggNurbsSurface.cxx b/panda/src/egg/eggNurbsSurface.cxx index c89ebfe157..8dc19be6fb 100644 --- a/panda/src/egg/eggNurbsSurface.cxx +++ b/panda/src/egg/eggNurbsSurface.cxx @@ -168,7 +168,7 @@ is_closed_v() const { * Writes the nurbsSurface to the indicated output stream in Egg format. */ void EggNurbsSurface:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { write_header(out, indent_level, ""); Trims::const_iterator ti; diff --git a/panda/src/egg/eggPatch.cxx b/panda/src/egg/eggPatch.cxx index 0bed947622..f3bbd30444 100644 --- a/panda/src/egg/eggPatch.cxx +++ b/panda/src/egg/eggPatch.cxx @@ -33,7 +33,7 @@ make_copy() const { * Writes the patch to the indicated output stream in Egg format. */ void EggPatch:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { write_header(out, indent_level, ""); write_body(out, indent_level+2); indent(out, indent_level) << "}\n"; diff --git a/panda/src/egg/eggPoint.cxx b/panda/src/egg/eggPoint.cxx index a344ee59cd..1545b6649d 100644 --- a/panda/src/egg/eggPoint.cxx +++ b/panda/src/egg/eggPoint.cxx @@ -41,7 +41,7 @@ cleanup() { * Writes the point to the indicated output stream in Egg format. */ void EggPoint:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { write_header(out, indent_level, ""); if (has_thick()) { diff --git a/panda/src/egg/eggPolygon.cxx b/panda/src/egg/eggPolygon.cxx index cb783925e1..5863d988e5 100644 --- a/panda/src/egg/eggPolygon.cxx +++ b/panda/src/egg/eggPolygon.cxx @@ -159,7 +159,7 @@ triangulate_in_place(bool convex_also) { * Writes the polygon to the indicated output stream in Egg format. */ void EggPolygon:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { write_header(out, indent_level, ""); write_body(out, indent_level+2); indent(out, indent_level) << "}\n"; diff --git a/panda/src/egg/eggPolysetMaker.cxx b/panda/src/egg/eggPolysetMaker.cxx index ddd2200df6..83d0de6d89 100644 --- a/panda/src/egg/eggPolysetMaker.cxx +++ b/panda/src/egg/eggPolysetMaker.cxx @@ -66,7 +66,7 @@ sorts_less(int bin_number, const EggNode *a, const EggNode *b) { } } if ((_properties & (P_texture)) != 0) { - int num_textures = min(pa->get_num_textures(), pb->get_num_textures()); + int num_textures = std::min(pa->get_num_textures(), pb->get_num_textures()); for (int i = 0; i < num_textures; i++) { EggTexture *a_texture = pa->get_texture(i); EggTexture *b_texture = pb->get_texture(i); diff --git a/panda/src/egg/eggPoolUniquifier.cxx b/panda/src/egg/eggPoolUniquifier.cxx index 859bd0aff0..86f8eea1e3 100644 --- a/panda/src/egg/eggPoolUniquifier.cxx +++ b/panda/src/egg/eggPoolUniquifier.cxx @@ -33,7 +33,7 @@ EggPoolUniquifier() { * Returns the category name into which the given node should be collected, or * the empty string if the node's name should be left alone. */ -string EggPoolUniquifier:: +std::string EggPoolUniquifier:: get_category(EggNode *node) { if (node->is_of_type(EggTexture::get_class_type())) { return "tex"; @@ -43,5 +43,5 @@ get_category(EggNode *node) { return "vpool"; } - return string(); + return std::string(); } diff --git a/panda/src/egg/eggPrimitive.cxx b/panda/src/egg/eggPrimitive.cxx index ee35080416..f4985dfc90 100644 --- a/panda/src/egg/eggPrimitive.cxx +++ b/panda/src/egg/eggPrimitive.cxx @@ -821,7 +821,7 @@ prepare_remove_vertex(EggVertex *vertex, int i, int n) { * indicated output stream in Egg format. */ void EggPrimitive:: -write_body(ostream &out, int indent_level) const { +write_body(std::ostream &out, int indent_level) const { test_vref_integrity(); EggAttributes::write(out, indent_level); @@ -977,7 +977,7 @@ r_apply_texmats(EggTextureCollection &textures) { EggTexture *unique = textures.create_unique_texture(new_texture, ~0); new_textures.push_back(unique); - string uv_name = unique->get_uv_name(); + std::string uv_name = unique->get_uv_name(); // Now apply the matrix to the vertex UV's. Create new vertices as // necessary. diff --git a/panda/src/egg/eggRenderMode.cxx b/panda/src/egg/eggRenderMode.cxx index 7c7e478a6d..5ac4b05844 100644 --- a/panda/src/egg/eggRenderMode.cxx +++ b/panda/src/egg/eggRenderMode.cxx @@ -16,6 +16,10 @@ #include "string_utils.h" #include "pnotify.h" +using std::istream; +using std::ostream; +using std::string; + TypeHandle EggRenderMode::_type_handle; /** diff --git a/panda/src/egg/eggSAnimData.cxx b/panda/src/egg/eggSAnimData.cxx index 27d3a88ed6..2dd63d24a1 100644 --- a/panda/src/egg/eggSAnimData.cxx +++ b/panda/src/egg/eggSAnimData.cxx @@ -48,7 +48,7 @@ optimize() { * Writes the data to the indicated output stream in Egg format. */ void EggSAnimData:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { if (get_num_rows() <= 1) { // We get a lot of these little tiny tables. For brevity, we'll write // these all on one line, because we can. This just makes it easier for a diff --git a/panda/src/egg/eggSwitchCondition.cxx b/panda/src/egg/eggSwitchCondition.cxx index d461c406f7..1515563d50 100644 --- a/panda/src/egg/eggSwitchCondition.cxx +++ b/panda/src/egg/eggSwitchCondition.cxx @@ -45,7 +45,7 @@ make_copy() const { * */ void EggSwitchConditionDistance:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << " {\n"; indent(out, indent_level+2) << " { " << _switch_in << " " << _switch_out; diff --git a/panda/src/egg/eggTable.cxx b/panda/src/egg/eggTable.cxx index b8372e41af..234c40c5f8 100644 --- a/panda/src/egg/eggTable.cxx +++ b/panda/src/egg/eggTable.cxx @@ -41,7 +41,7 @@ has_transform() const { * Egg format. */ void EggTable:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { test_under_integrity(); switch (get_table_type()) { @@ -69,7 +69,7 @@ write(ostream &out, int indent_level) const { * TableType value. */ EggTable::TableType EggTable:: -string_table_type(const string &string) { +string_table_type(const std::string &string) { if (cmp_nocase_uh(string, "table") == 0) { return TT_table; } else if (cmp_nocase_uh(string, "bundle") == 0) { @@ -137,7 +137,7 @@ r_transform(const LMatrix4d &mat, const LMatrix4d &inv, /** * */ -ostream &operator << (ostream &out, EggTable::TableType t) { +std::ostream &operator << (std::ostream &out, EggTable::TableType t) { switch (t) { case EggTable::TT_invalid: return out << "invalid table"; diff --git a/panda/src/egg/eggTexture.cxx b/panda/src/egg/eggTexture.cxx index 85327cb915..eb2cfa7342 100644 --- a/panda/src/egg/eggTexture.cxx +++ b/panda/src/egg/eggTexture.cxx @@ -18,6 +18,9 @@ #include "indent.h" #include "string_utils.h" +using std::ostream; +using std::string; + TypeHandle EggTexture::_type_handle; diff --git a/panda/src/egg/eggTextureCollection.cxx b/panda/src/egg/eggTextureCollection.cxx index 38ee134048..0c1b46eea7 100644 --- a/panda/src/egg/eggTextureCollection.cxx +++ b/panda/src/egg/eggTextureCollection.cxx @@ -271,7 +271,7 @@ collapse_equivalent_textures(int eq, EggTextureCollection::TextureReplacement &r ++oti) { EggTexture *tex = (*oti); - pair result = collapser.insert(tex); + std::pair result = collapser.insert(tex); if (!result.second) { // This texture is non-unique; another one was already there. EggTexture *first = *(result.first); @@ -453,7 +453,7 @@ create_unique_texture(const EggTexture ©, int eq) { * matches. */ EggTexture *EggTextureCollection:: -find_tref(const string &tref_name) const { +find_tref(const std::string &tref_name) const { // This requires a complete linear traversal, not terribly efficient. OrderedTextures::const_iterator oti; for (oti = _ordered_textures.begin(); diff --git a/panda/src/egg/eggTransform.cxx b/panda/src/egg/eggTransform.cxx index 67ce77e1bc..65ba63c3e7 100644 --- a/panda/src/egg/eggTransform.cxx +++ b/panda/src/egg/eggTransform.cxx @@ -186,7 +186,7 @@ add_uniform_scale(double scale) { * Writes the transform to the indicated stream in Egg format. */ void EggTransform:: -write(ostream &out, int indent_level, const string &label) const { +write(std::ostream &out, int indent_level, const std::string &label) const { indent(out, indent_level) << label << " {\n"; int num_components = get_num_components(); diff --git a/panda/src/egg/eggTriangleFan.cxx b/panda/src/egg/eggTriangleFan.cxx index 6ad3b4f5ae..5287d1c8e9 100644 --- a/panda/src/egg/eggTriangleFan.cxx +++ b/panda/src/egg/eggTriangleFan.cxx @@ -38,7 +38,7 @@ make_copy() const { * Writes the triangle fan to the indicated output stream in Egg format. */ void EggTriangleFan:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { write_header(out, indent_level, ""); write_body(out, indent_level+2); indent(out, indent_level) << "}\n"; diff --git a/panda/src/egg/eggTriangleStrip.cxx b/panda/src/egg/eggTriangleStrip.cxx index 5882471c9e..a0aa83b144 100644 --- a/panda/src/egg/eggTriangleStrip.cxx +++ b/panda/src/egg/eggTriangleStrip.cxx @@ -38,7 +38,7 @@ make_copy() const { * Writes the triangle strip to the indicated output stream in Egg format. */ void EggTriangleStrip:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { write_header(out, indent_level, ""); write_body(out, indent_level+2); indent(out, indent_level) << "}\n"; diff --git a/panda/src/egg/eggVertex.cxx b/panda/src/egg/eggVertex.cxx index 5272a9f034..cebf9608e7 100644 --- a/panda/src/egg/eggVertex.cxx +++ b/panda/src/egg/eggVertex.cxx @@ -26,6 +26,9 @@ #include #include +using std::ostream; +using std::string; + TypeHandle EggVertex::_type_handle; diff --git a/panda/src/egg/eggVertexAux.cxx b/panda/src/egg/eggVertexAux.cxx index 6b12ee538b..b421c527f6 100644 --- a/panda/src/egg/eggVertexAux.cxx +++ b/panda/src/egg/eggVertexAux.cxx @@ -22,7 +22,7 @@ TypeHandle EggVertexAux::_type_handle; * */ EggVertexAux:: -EggVertexAux(const string &name, const LVecBase4d &aux) : +EggVertexAux(const std::string &name, const LVecBase4d &aux) : EggNamedObject(name), _aux(aux) { @@ -72,8 +72,8 @@ make_average(const EggVertexAux *first, const EggVertexAux *second) { * */ void EggVertexAux:: -write(ostream &out, int indent_level) const { - string inline_name = get_name(); +write(std::ostream &out, int indent_level) const { + std::string inline_name = get_name(); if (!inline_name.empty()) { inline_name += ' '; } diff --git a/panda/src/egg/eggVertexPool.cxx b/panda/src/egg/eggVertexPool.cxx index e3b3cad248..8fa3b5e637 100644 --- a/panda/src/egg/eggVertexPool.cxx +++ b/panda/src/egg/eggVertexPool.cxx @@ -20,6 +20,8 @@ #include +using std::string; + TypeHandle EggVertexPool::_type_handle; /** @@ -176,7 +178,7 @@ get_num_dimensions() const { IndexVertices::const_iterator ivi; for (ivi = _index_vertices.begin(); ivi != _index_vertices.end(); ++ivi) { EggVertex *vertex = (*ivi).second; - num_dimensions = max(num_dimensions, vertex->get_num_dimensions()); + num_dimensions = std::max(num_dimensions, vertex->get_num_dimensions()); } return num_dimensions; @@ -438,7 +440,7 @@ add_vertex(EggVertex *vertex, int index) { !vertex->is_forward_reference()) { (*orig_vertex) = (*vertex); orig_vertex->_forward_reference = false; - _highest_index = max(_highest_index, index); + _highest_index = std::max(_highest_index, index); return orig_vertex; } @@ -450,7 +452,7 @@ add_vertex(EggVertex *vertex, int index) { _index_vertices[index] = vertex; if (!vertex->is_forward_reference()) { - _highest_index = max(_highest_index, index); + _highest_index = std::max(_highest_index, index); } vertex->_pool = this; @@ -761,7 +763,7 @@ sort_by_external_index() { * Writes the vertex pool to the indicated output stream in Egg format. */ void EggVertexPool:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { write_header(out, indent_level, ""); iterator i; diff --git a/panda/src/egg/eggVertexUV.cxx b/panda/src/egg/eggVertexUV.cxx index 4ba501d4c3..49a3c39ace 100644 --- a/panda/src/egg/eggVertexUV.cxx +++ b/panda/src/egg/eggVertexUV.cxx @@ -22,7 +22,7 @@ TypeHandle EggVertexUV::_type_handle; * */ EggVertexUV:: -EggVertexUV(const string &name, const LTexCoordd &uv) : +EggVertexUV(const std::string &name, const LTexCoordd &uv) : EggNamedObject(name), _flags(0), _uvw(uv[0], uv[1], 0.0) @@ -36,7 +36,7 @@ EggVertexUV(const string &name, const LTexCoordd &uv) : * */ EggVertexUV:: -EggVertexUV(const string &name, const LTexCoord3d &uvw) : +EggVertexUV(const std::string &name, const LTexCoord3d &uvw) : EggNamedObject(name), _flags(F_has_w), _uvw(uvw) @@ -124,8 +124,8 @@ transform(const LMatrix4d &mat) { * */ void EggVertexUV:: -write(ostream &out, int indent_level) const { - string inline_name = get_name(); +write(std::ostream &out, int indent_level) const { + std::string inline_name = get_name(); if (!inline_name.empty()) { inline_name += ' '; } diff --git a/panda/src/egg/eggXfmAnimData.cxx b/panda/src/egg/eggXfmAnimData.cxx index 62ed89f1c3..73a7128036 100644 --- a/panda/src/egg/eggXfmAnimData.cxx +++ b/panda/src/egg/eggXfmAnimData.cxx @@ -164,7 +164,7 @@ is_anim_matrix() const { * Writes the data to the indicated output stream in Egg format. */ void EggXfmAnimData:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { write_header(out, indent_level, ""); if (has_fps()) { diff --git a/panda/src/egg/eggXfmSAnim.cxx b/panda/src/egg/eggXfmSAnim.cxx index c28d8c6c4e..43a784b33f 100644 --- a/panda/src/egg/eggXfmSAnim.cxx +++ b/panda/src/egg/eggXfmSAnim.cxx @@ -23,6 +23,8 @@ #include +using std::string; + TypeHandle EggXfmSAnim::_type_handle; const string EggXfmSAnim::_standard_order = "srpht"; @@ -138,7 +140,7 @@ is_anim_matrix() const { * Writes the data to the indicated output stream in Egg format. */ void EggXfmSAnim:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { test_under_integrity(); write_header(out, indent_level, ""); @@ -271,7 +273,7 @@ get_num_rows() const { min_rows = sanim->get_num_rows(); } else { - min_rows = min(min_rows, sanim->get_num_rows()); + min_rows = std::min(min_rows, sanim->get_num_rows()); } } } diff --git a/panda/src/egg/lexer.cxx.prebuilt b/panda/src/egg/lexer.cxx.prebuilt index ef8160d2c2..c736ac335e 100644 --- a/panda/src/egg/lexer.cxx.prebuilt +++ b/panda/src/egg/lexer.cxx.prebuilt @@ -963,6 +963,10 @@ char *eggyytext; #include +using std::istream; +using std::ostream; +using std::string; + extern "C" int eggyywrap(void); // declared below. static int yyinput(void); // declared by flex. @@ -1072,7 +1076,7 @@ eggyyerror(const string &msg) { } void -eggyyerror(ostringstream &strm) { +eggyyerror(std::ostringstream &strm) { string s = strm.str(); eggyyerror(s); } @@ -1098,8 +1102,8 @@ eggyywarning(const string &msg) { } void -eggyywarning(ostringstream &strm) { - string s = strm.str(); +eggyywarning(std::ostringstream &strm) { + std::string s = strm.str(); eggyywarning(s); } @@ -1117,7 +1121,7 @@ input_chars(char *buffer, int &result, int max_size) { // from the stream, copy it into the current_line array. This // is because the \n.* rule below, which fills current_line // normally, doesn't catch the first line. - int length = min(max_error_width, result); + int length = std::min(max_error_width, result); strncpy(current_line, buffer, length); current_line[length] = '\0'; line_number++; @@ -1212,7 +1216,7 @@ eat_c_comment() { c = read_char(line, col); while (c != EOF && !(last_c == '*' && c == '/')) { if (last_c == '/' && c == '*') { - ostringstream errmsg; + std::ostringstream errmsg; errmsg << "This comment contains a nested /* symbol at line " << line << ", column " << col-1 << "--possibly unclosed?" << std::ends; diff --git a/panda/src/egg/lexer.lxx b/panda/src/egg/lexer.lxx index 468a393418..1c07166635 100644 --- a/panda/src/egg/lexer.lxx +++ b/panda/src/egg/lexer.lxx @@ -18,6 +18,10 @@ #include +using std::istream; +using std::ostream; +using std::string; + extern "C" int eggyywrap(void); // declared below. static int yyinput(void); // declared by flex. @@ -127,7 +131,7 @@ eggyyerror(const string &msg) { } void -eggyyerror(ostringstream &strm) { +eggyyerror(std::ostringstream &strm) { string s = strm.str(); eggyyerror(s); } @@ -153,7 +157,7 @@ eggyywarning(const string &msg) { } void -eggyywarning(ostringstream &strm) { +eggyywarning(std::ostringstream &strm) { string s = strm.str(); eggyywarning(s); } @@ -172,7 +176,7 @@ input_chars(char *buffer, int &result, int max_size) { // from the stream, copy it into the current_line array. This // is because the \n.* rule below, which fills current_line // normally, doesn't catch the first line. - int length = min(max_error_width, result); + int length = std::min(max_error_width, result); strncpy(current_line, buffer, length); current_line[length] = '\0'; line_number++; @@ -267,7 +271,7 @@ eat_c_comment() { c = read_char(line, col); while (c != EOF && !(last_c == '*' && c == '/')) { if (last_c == '/' && c == '*') { - ostringstream errmsg; + std::ostringstream errmsg; errmsg << "This comment contains a nested /* symbol at line " << line << ", column " << col-1 << "--possibly unclosed?" << std::ends; diff --git a/panda/src/egg/parser.cxx.prebuilt b/panda/src/egg/parser.cxx.prebuilt index b25f0abf32..f9a81a30a5 100644 --- a/panda/src/egg/parser.cxx.prebuilt +++ b/panda/src/egg/parser.cxx.prebuilt @@ -129,6 +129,10 @@ #define YYINITDEPTH 1000 #define YYMAXDEPTH 1000 +using std::istream; +using std::ostringstream; +using std::string; + // We need a stack of EggObject pointers. Each time we encounter a // nested EggObject of some kind, we'll allocate a new one of these // and push it onto the stack. At any given time, the top of the diff --git a/panda/src/egg/parser.yxx b/panda/src/egg/parser.yxx index 8bdd6ee39d..1ffaa3a078 100644 --- a/panda/src/egg/parser.yxx +++ b/panda/src/egg/parser.yxx @@ -57,6 +57,10 @@ #define YYINITDEPTH 1000 #define YYMAXDEPTH 1000 +using std::istream; +using std::ostringstream; +using std::string; + // We need a stack of EggObject pointers. Each time we encounter a // nested EggObject of some kind, we'll allocate a new one of these // and push it onto the stack. At any given time, the top of the diff --git a/panda/src/egg/test_egg.cxx b/panda/src/egg/test_egg.cxx index ae91d3548d..8023145331 100644 --- a/panda/src/egg/test_egg.cxx +++ b/panda/src/egg/test_egg.cxx @@ -28,7 +28,7 @@ main(int argc, char *argv[]) { if (data.read(egg_filename)) { data.load_externals(DSearchPath(Filename(""))); - data.write_egg(cout); + data.write_egg(std::cout); } else { nout << "Errors.\n"; } diff --git a/panda/src/egg2pg/animBundleMaker.cxx b/panda/src/egg2pg/animBundleMaker.cxx index b32f6d79a5..ea5ac4285f 100644 --- a/panda/src/egg2pg/animBundleMaker.cxx +++ b/panda/src/egg2pg/animBundleMaker.cxx @@ -25,6 +25,8 @@ #include "animChannelMatrixXfmTable.h" #include "animChannelScalarTable.h" +using std::min; + /** * */ @@ -212,7 +214,7 @@ build_hierarchy(EggTable *egg_table, AnimGroup *parent) { * structure. */ AnimChannelScalarTable *AnimBundleMaker:: -create_s_channel(EggSAnimData *egg_anim, const string &name, +create_s_channel(EggSAnimData *egg_anim, const std::string &name, AnimGroup *parent) { AnimChannelScalarTable *table = new AnimChannelScalarTable(parent, name); @@ -236,7 +238,7 @@ create_s_channel(EggSAnimData *egg_anim, const string &name, * structure, if possible. */ AnimChannelMatrixXfmTable *AnimBundleMaker:: -create_xfm_channel(EggNode *egg_node, const string &name, +create_xfm_channel(EggNode *egg_node, const std::string &name, AnimGroup *parent) { if (egg_node->is_of_type(EggXfmAnimData::get_class_type())) { EggXfmAnimData *egg_anim = DCAST(EggXfmAnimData, egg_node); @@ -260,7 +262,7 @@ create_xfm_channel(EggNode *egg_node, const string &name, * structure. */ AnimChannelMatrixXfmTable *AnimBundleMaker:: -create_xfm_channel(EggXfmSAnim *egg_anim, const string &name, +create_xfm_channel(EggXfmSAnim *egg_anim, const std::string &name, AnimGroup *parent) { // Ensure that the anim table is optimal and that it is standard order. egg_anim->optimize_to_standard_order(); diff --git a/panda/src/egg2pg/characterMaker.cxx b/panda/src/egg2pg/characterMaker.cxx index 11c3a4e9b4..f087ebf88e 100644 --- a/panda/src/egg2pg/characterMaker.cxx +++ b/panda/src/egg2pg/characterMaker.cxx @@ -34,6 +34,8 @@ #include "eggAnimPreload.h" #include "animPreloadTable.h" +using std::string; + diff --git a/panda/src/egg2pg/eggBinner.cxx b/panda/src/egg2pg/eggBinner.cxx index 66471661f8..9d24341f91 100644 --- a/panda/src/egg2pg/eggBinner.cxx +++ b/panda/src/egg2pg/eggBinner.cxx @@ -76,13 +76,13 @@ get_bin_number(const EggNode *node) { * May be overridden in derived classes to define a name for each new bin, * based on its bin number, and a sample child. */ -string EggBinner:: +std::string EggBinner:: get_bin_name(int bin_number, const EggNode *child) { if (bin_number == BN_polyset || bin_number == BN_patches) { return DCAST(EggPrimitive, child)->get_sort_name(); } - return string(); + return std::string(); } /** diff --git a/panda/src/egg2pg/eggLoader.cxx b/panda/src/egg2pg/eggLoader.cxx index ae2c30a8c3..e26a4120b9 100644 --- a/panda/src/egg2pg/eggLoader.cxx +++ b/panda/src/egg2pg/eggLoader.cxx @@ -100,6 +100,10 @@ #include #include +using std::max; +using std::min; +using std::string; + // This class is used in make_node(EggBin *) to sort LOD instances in order by // switching distance. class LODInstance { @@ -2584,7 +2588,7 @@ make_primitive(const EggRenderState *render_state, EggPrimitive *egg_prim, // Insert the primitive into the set, but if we already have a primitive of // that type, reset the pointer to that one instead. PrimitiveUnifier pu(primitive); - pair result = + std::pair result = unique_primitives.insert(UniquePrimitives::value_type(pu, primitive)); if (result.second) { diff --git a/panda/src/egg2pg/eggRenderState.cxx b/panda/src/egg2pg/eggRenderState.cxx index 5612826ec0..4c5baf6e3a 100644 --- a/panda/src/egg2pg/eggRenderState.cxx +++ b/panda/src/egg2pg/eggRenderState.cxx @@ -59,7 +59,7 @@ fill_state(EggPrimitive *egg_prim) { bool has_depth_offset = false; int depth_offset = 0; bool has_bin = false; - string bin; + std::string bin; EggRenderMode *render_mode; render_mode = egg_prim->determine_alpha_mode(); @@ -151,7 +151,7 @@ fill_state(EggPrimitive *egg_prim) { // of textures that share this same set of UV's per each unique texture // matrix. Whew!) CPT(InternalName) uv_name; - if (egg_tex->has_uv_name() && egg_tex->get_uv_name() != string("default")) { + if (egg_tex->has_uv_name() && egg_tex->get_uv_name() != std::string("default")) { uv_name = InternalName::get_texcoord_name(egg_tex->get_uv_name()); } else { uv_name = InternalName::get_texcoord(); diff --git a/panda/src/egg2pg/eggSaver.cxx b/panda/src/egg2pg/eggSaver.cxx index af70617e36..fb6bb3a59b 100644 --- a/panda/src/egg2pg/eggSaver.cxx +++ b/panda/src/egg2pg/eggSaver.cxx @@ -75,6 +75,9 @@ #include "eggTable.h" #include "dcast.h" +using std::pair; +using std::string; + /** * */ @@ -191,7 +194,7 @@ convert_lod_node(LODNode *node, const WorkingNodePath &node_path, int num_children = node->get_num_children(); int num_switches = node->get_num_switches(); - num_children = min(num_children, num_switches); + num_children = std::min(num_children, num_switches); for (int i = 0; i < num_children; i++) { PandaNode *child = node->get_child(i); @@ -1148,7 +1151,7 @@ apply_state_properties(EggRenderMode *egg_render_mode, const RenderState *state) */ bool EggSaver:: apply_tags(EggGroup *egg_group, PandaNode *node) { - ostringstream strm; + std::ostringstream strm; char delimiter = '\n'; string delimiter_str(1, delimiter); node->list_tags(strm, delimiter_str); diff --git a/panda/src/egg2pg/load_egg_file.cxx b/panda/src/egg2pg/load_egg_file.cxx index bee738af4b..f6f3fa8f8b 100644 --- a/panda/src/egg2pg/load_egg_file.cxx +++ b/panda/src/egg2pg/load_egg_file.cxx @@ -94,7 +94,7 @@ load_egg_file(const Filename &filename, CoordinateSystem cs, loader._data->set_egg_timestamp(vfile->get_timestamp()); bool okflag; - istream *istr = vfile->open_read_file(true); + std::istream *istr = vfile->open_read_file(true); if (istr == nullptr) { egg2pg_cat.error() << "Couldn't read " << egg_filename << "\n"; diff --git a/panda/src/egg2pg/loaderFileTypeEgg.cxx b/panda/src/egg2pg/loaderFileTypeEgg.cxx index a5bbd96210..281e2ca51f 100644 --- a/panda/src/egg2pg/loaderFileTypeEgg.cxx +++ b/panda/src/egg2pg/loaderFileTypeEgg.cxx @@ -29,7 +29,7 @@ LoaderFileTypeEgg() { /** * */ -string LoaderFileTypeEgg:: +std::string LoaderFileTypeEgg:: get_name() const { return "Egg"; } @@ -37,7 +37,7 @@ get_name() const { /** * */ -string LoaderFileTypeEgg:: +std::string LoaderFileTypeEgg:: get_extension() const { return "egg"; } diff --git a/panda/src/egldisplay/config_egldisplay.cxx b/panda/src/egldisplay/config_egldisplay.cxx index 9f9bf13770..f76b1b9d1f 100644 --- a/panda/src/egldisplay/config_egldisplay.cxx +++ b/panda/src/egldisplay/config_egldisplay.cxx @@ -63,7 +63,7 @@ init_libegldisplay() { /** * Returns the given EGL error as string. */ -const string get_egl_error_string(int error) { +const std::string get_egl_error_string(int error) { switch (error) { case 0x3000: return "EGL_SUCCESS"; break; case 0x3001: return "EGL_NOT_INITIALIZED"; break; diff --git a/panda/src/egldisplay/eglGraphicsBuffer.cxx b/panda/src/egldisplay/eglGraphicsBuffer.cxx index 07057818ab..a0cf71f1fa 100644 --- a/panda/src/egldisplay/eglGraphicsBuffer.cxx +++ b/panda/src/egldisplay/eglGraphicsBuffer.cxx @@ -26,7 +26,7 @@ TypeHandle eglGraphicsBuffer::_type_handle; */ eglGraphicsBuffer:: eglGraphicsBuffer(GraphicsEngine *engine, GraphicsPipe *pipe, - const string &name, + const std::string &name, const FrameBufferProperties &fb_prop, const WindowProperties &win_prop, int flags, diff --git a/panda/src/egldisplay/eglGraphicsPipe.cxx b/panda/src/egldisplay/eglGraphicsPipe.cxx index 93ddb7f92c..17594f799e 100644 --- a/panda/src/egldisplay/eglGraphicsPipe.cxx +++ b/panda/src/egldisplay/eglGraphicsPipe.cxx @@ -25,7 +25,7 @@ TypeHandle eglGraphicsPipe::_type_handle; * */ eglGraphicsPipe:: -eglGraphicsPipe(const string &display) : x11GraphicsPipe(display) { +eglGraphicsPipe(const std::string &display) : x11GraphicsPipe(display) { _egl_display = eglGetDisplay((NativeDisplayType) _display); if (!eglInitialize(_egl_display, nullptr, nullptr)) { egldisplay_cat.error() @@ -59,7 +59,7 @@ eglGraphicsPipe:: * choose between several possible GraphicsPipes available on a particular * platform, so the name should be meaningful and unique for a given platform. */ -string eglGraphicsPipe:: +std::string eglGraphicsPipe:: get_interface_name() const { return "OpenGL ES"; } @@ -77,7 +77,7 @@ pipe_constructor() { * Creates a new window on the pipe, if possible. */ PT(GraphicsOutput) eglGraphicsPipe:: -make_output(const string &name, +make_output(const std::string &name, const FrameBufferProperties &fb_prop, const WindowProperties &win_prop, int flags, diff --git a/panda/src/egldisplay/eglGraphicsPixmap.cxx b/panda/src/egldisplay/eglGraphicsPixmap.cxx index ec34b460a3..5933416f5c 100644 --- a/panda/src/egldisplay/eglGraphicsPixmap.cxx +++ b/panda/src/egldisplay/eglGraphicsPixmap.cxx @@ -27,7 +27,7 @@ TypeHandle eglGraphicsPixmap::_type_handle; */ eglGraphicsPixmap:: eglGraphicsPixmap(GraphicsEngine *engine, GraphicsPipe *pipe, - const string &name, + const std::string &name, const FrameBufferProperties &fb_prop, const WindowProperties &win_prop, int flags, diff --git a/panda/src/egldisplay/eglGraphicsStateGuardian.cxx b/panda/src/egldisplay/eglGraphicsStateGuardian.cxx index 0d9a70e910..31c1069d46 100644 --- a/panda/src/egldisplay/eglGraphicsStateGuardian.cxx +++ b/panda/src/egldisplay/eglGraphicsStateGuardian.cxx @@ -258,8 +258,8 @@ reset() { // If "Mesa" is present, assume software. However, if "Mesa DRI" is found, // it's actually a Mesa-based OpenGL layer running over a hardware driver. if (_gl_renderer == "Software Rasterizer" || - (_gl_renderer.find("Mesa") != string::npos && - _gl_renderer.find("Mesa DRI") == string::npos)) { + (_gl_renderer.find("Mesa") != std::string::npos && + _gl_renderer.find("Mesa DRI") == std::string::npos)) { // It's Mesa, therefore probably a software context. _fbprops.set_force_software(1); _fbprops.set_force_hardware(0); diff --git a/panda/src/egldisplay/eglGraphicsWindow.cxx b/panda/src/egldisplay/eglGraphicsWindow.cxx index 094d4ae547..29f7ffbf49 100644 --- a/panda/src/egldisplay/eglGraphicsWindow.cxx +++ b/panda/src/egldisplay/eglGraphicsWindow.cxx @@ -34,7 +34,7 @@ TypeHandle eglGraphicsWindow::_type_handle; */ eglGraphicsWindow:: eglGraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe, - const string &name, + const std::string &name, const FrameBufferProperties &fb_prop, const WindowProperties &win_prop, int flags, diff --git a/panda/src/event/asyncFuture.cxx b/panda/src/event/asyncFuture.cxx index d97173d54d..16540954ed 100644 --- a/panda/src/event/asyncFuture.cxx +++ b/panda/src/event/asyncFuture.cxx @@ -55,7 +55,7 @@ cancel() { * */ void AsyncFuture:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type(); FutureState state = (FutureState)AtomicAdjust::get(_future_state); switch (state) { @@ -159,7 +159,7 @@ notify_done(bool clean_exit) { if (clean_exit && !_done_event.empty()) { PT_Event event = new Event(_done_event); event->add_parameter(EventParameter(this)); - throw_event(move(event)); + throw_event(std::move(event)); } } @@ -308,7 +308,7 @@ wake_task(AsyncTask *task) { */ AsyncGatheringFuture:: AsyncGatheringFuture(AsyncFuture::Futures futures) : - _futures(move(futures)), + _futures(std::move(futures)), _num_pending(0) { bool any_pending = false; diff --git a/panda/src/event/asyncFuture_ext.cxx b/panda/src/event/asyncFuture_ext.cxx index 3150c09d7d..00ee3516b1 100644 --- a/panda/src/event/asyncFuture_ext.cxx +++ b/panda/src/event/asyncFuture_ext.cxx @@ -306,7 +306,7 @@ gather(PyObject *args) { return Dtool_Raise_ArgTypeError(item, i, "gather", "coroutine, task or future"); } - AsyncFuture *future = AsyncFuture::gather(move(futures)); + AsyncFuture *future = AsyncFuture::gather(std::move(futures)); if (future != nullptr) { future->ref(); return DTool_CreatePyInstanceTyped((void *)future, Dtool_AsyncFuture, true, false, future->get_type_index()); diff --git a/panda/src/event/asyncTask.cxx b/panda/src/event/asyncTask.cxx index f5a796643c..806d8e87af 100644 --- a/panda/src/event/asyncTask.cxx +++ b/panda/src/event/asyncTask.cxx @@ -18,6 +18,8 @@ #include "throw_event.h" #include "eventParameter.h" +using std::string; + AtomicAdjust::Integer AsyncTask::_next_task_id; PStatCollector AsyncTask::_show_code_pcollector("App:Show code"); TypeHandle AsyncTask::_type_handle; @@ -187,7 +189,7 @@ set_name(const string &name) { size_t end = name.size(); size_t colon = name.find(':'); if (colon != string::npos) { - end = min(end, colon); + end = std::min(end, colon); } // If the name ends with a hyphen followed by a string of digits, we strip @@ -364,7 +366,7 @@ set_priority(int priority) { * */ void AsyncTask:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type(); if (has_name()) { out << " " << get_name(); @@ -427,7 +429,7 @@ unlock_and_do_task() { _manager->_lock.lock(); _dt = end - start; - _max_dt = max(_dt, _max_dt); + _max_dt = std::max(_dt, _max_dt); _total_dt += _dt; _chain->_time_in_frame += _dt; diff --git a/panda/src/event/asyncTaskChain.cxx b/panda/src/event/asyncTaskChain.cxx index eb00a5b08d..34e458691e 100644 --- a/panda/src/event/asyncTaskChain.cxx +++ b/panda/src/event/asyncTaskChain.cxx @@ -23,6 +23,11 @@ #include #include // For sprintf/snprintf +using std::max; +using std::ostream; +using std::ostringstream; +using std::string; + TypeHandle AsyncTaskChain::_type_handle; PStatCollector AsyncTaskChain::_task_pcollector("Task"); diff --git a/panda/src/event/asyncTaskCollection.cxx b/panda/src/event/asyncTaskCollection.cxx index af5b1bc2f5..b6fd56fece 100644 --- a/panda/src/event/asyncTaskCollection.cxx +++ b/panda/src/event/asyncTaskCollection.cxx @@ -174,7 +174,7 @@ clear() { * if no task has that name. */ AsyncTask *AsyncTaskCollection:: -find_task(const string &name) const { +find_task(const std::string &name) const { size_t num_tasks = get_num_tasks(); for (size_t i = 0; i < num_tasks; ++i) { AsyncTask *task = get_task(i); @@ -246,7 +246,7 @@ size() const { * indicated output stream. */ void AsyncTaskCollection:: -output(ostream &out) const { +output(std::ostream &out) const { if (get_num_tasks() == 1) { out << "1 AsyncTask"; } else { @@ -259,7 +259,7 @@ output(ostream &out) const { * indicated output stream. */ void AsyncTaskCollection:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { for (size_t i = 0; i < get_num_tasks(); i++) { indent(out, indent_level) << *get_task(i) << "\n"; } diff --git a/panda/src/event/asyncTaskManager.cxx b/panda/src/event/asyncTaskManager.cxx index a9bab44898..b80908ddc5 100644 --- a/panda/src/event/asyncTaskManager.cxx +++ b/panda/src/event/asyncTaskManager.cxx @@ -22,6 +22,8 @@ #include "config_event.h" #include +using std::string; + AsyncTaskManager *AsyncTaskManager::_global_ptr = nullptr; TypeHandle AsyncTaskManager::_type_handle; @@ -508,7 +510,7 @@ get_next_wake_time() const { got_any = true; next_wake_time = time; } else { - next_wake_time = min(time, next_wake_time); + next_wake_time = std::min(time, next_wake_time); } } } @@ -520,7 +522,7 @@ get_next_wake_time() const { * */ void AsyncTaskManager:: -output(ostream &out) const { +output(std::ostream &out) const { MutexHolder holder(_lock); do_output(out); } @@ -529,7 +531,7 @@ output(ostream &out) const { * */ void AsyncTaskManager:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { MutexHolder holder(_lock); indent(out, indent_level) << get_type() << " " << get_name() << "\n"; @@ -629,7 +631,7 @@ do_has_task(AsyncTask *task) const { * */ void AsyncTaskManager:: -do_output(ostream &out) const { +do_output(std::ostream &out) const { out << get_type() << " " << get_name() << "; " << _num_tasks << " tasks"; } diff --git a/panda/src/event/asyncTaskSequence.cxx b/panda/src/event/asyncTaskSequence.cxx index b84a968386..82541ec8da 100644 --- a/panda/src/event/asyncTaskSequence.cxx +++ b/panda/src/event/asyncTaskSequence.cxx @@ -20,7 +20,7 @@ TypeHandle AsyncTaskSequence::_type_handle; * */ AsyncTaskSequence:: -AsyncTaskSequence(const string &name) : +AsyncTaskSequence(const std::string &name) : AsyncTask(name), _repeat_count(0), _task_index(0) diff --git a/panda/src/event/buttonEvent.cxx b/panda/src/event/buttonEvent.cxx index 38dbbffb6a..170812958b 100644 --- a/panda/src/event/buttonEvent.cxx +++ b/panda/src/event/buttonEvent.cxx @@ -21,7 +21,7 @@ * */ void ButtonEvent:: -output(ostream &out) const { +output(std::ostream &out) const { switch (_type) { case T_down: out << "button " << _button << " down"; diff --git a/panda/src/event/buttonEventList.cxx b/panda/src/event/buttonEventList.cxx index 633329a5a1..21c9d45981 100644 --- a/panda/src/event/buttonEventList.cxx +++ b/panda/src/event/buttonEventList.cxx @@ -45,7 +45,7 @@ update_mods(ModifierButtons &mods) const { * */ void ButtonEventList:: -output(ostream &out) const { +output(std::ostream &out) const { if (_events.empty()) { out << "(no buttons)"; } else { @@ -65,7 +65,7 @@ output(ostream &out) const { * */ void ButtonEventList:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << _events.size() << " events:\n"; Events::const_iterator ei; for (ei = _events.begin(); ei != _events.end(); ++ei) { diff --git a/panda/src/event/event.cxx b/panda/src/event/event.cxx index 4453b890f3..8a46d2586f 100644 --- a/panda/src/event/event.cxx +++ b/panda/src/event/event.cxx @@ -20,7 +20,7 @@ TypeHandle Event::_type_handle; * */ Event:: -Event(const string &event_name, EventReceiver *receiver) : +Event(const std::string &event_name, EventReceiver *receiver) : _name(event_name) { _receiver = receiver; @@ -117,7 +117,7 @@ clear_receiver() { * */ void Event:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_name(); out << "("; diff --git a/panda/src/event/eventHandler.cxx b/panda/src/event/eventHandler.cxx index 998946e92b..f74bd8c519 100644 --- a/panda/src/event/eventHandler.cxx +++ b/panda/src/event/eventHandler.cxx @@ -15,6 +15,8 @@ #include "eventQueue.h" #include "config_event.h" +using std::string; + TypeHandle EventHandler::_type_handle; EventHandler *EventHandler::_global_event_handler = nullptr; @@ -82,7 +84,7 @@ dispatch_event(const Event *event) { event_cat->spam() << "calling callback 0x" << (void*)(*fi) << " for event '" << event->get_name() << "'" - << endl; + << std::endl; } (*fi)(event); } @@ -120,7 +122,7 @@ dispatch_event(const Event *event) { * */ void EventHandler:: -write(ostream &out) const { +write(std::ostream &out) const { Hooks::const_iterator hi; hi = _hooks.begin(); @@ -165,7 +167,7 @@ add_hook(const string &event_name, EventFunction *function) { if (event_cat.is_debug()) { event_cat.debug() << "adding hook for event '" << event_name - << "' with function 0x" << (void*)function << endl; + << "' with function 0x" << (void*)function << std::endl; } assert(!event_name.empty()); assert(function); @@ -357,7 +359,7 @@ make_global_event_handler() { * */ void EventHandler:: -write_hook(ostream &out, const EventHandler::Hooks::value_type &hook) const { +write_hook(std::ostream &out, const EventHandler::Hooks::value_type &hook) const { if (!hook.second.empty()) { out << hook.first << " has " << hook.second.size() << " functions.\n"; } @@ -367,7 +369,7 @@ write_hook(ostream &out, const EventHandler::Hooks::value_type &hook) const { * */ void EventHandler:: -write_cbhook(ostream &out, const EventHandler::CallbackHooks::value_type &hook) const { +write_cbhook(std::ostream &out, const EventHandler::CallbackHooks::value_type &hook) const { if (!hook.second.empty()) { out << hook.first << " has " << hook.second.size() << " callback functions.\n"; } diff --git a/panda/src/event/eventParameter.cxx b/panda/src/event/eventParameter.cxx index 40122908cd..37f6690dae 100644 --- a/panda/src/event/eventParameter.cxx +++ b/panda/src/event/eventParameter.cxx @@ -21,7 +21,7 @@ template class ParamValue; * */ void EventParameter:: -output(ostream &out) const { +output(std::ostream &out) const { if (_ptr == nullptr) { out << "(empty)"; diff --git a/panda/src/event/genericAsyncTask.cxx b/panda/src/event/genericAsyncTask.cxx index c0d68fa3ff..f78fddecc3 100644 --- a/panda/src/event/genericAsyncTask.cxx +++ b/panda/src/event/genericAsyncTask.cxx @@ -20,7 +20,7 @@ TypeHandle GenericAsyncTask::_type_handle; * */ GenericAsyncTask:: -GenericAsyncTask(const string &name) : +GenericAsyncTask(const std::string &name) : AsyncTask(name) { _function = nullptr; @@ -33,7 +33,7 @@ GenericAsyncTask(const string &name) : * */ GenericAsyncTask:: -GenericAsyncTask(const string &name, GenericAsyncTask::TaskFunc *function, void *user_data) : +GenericAsyncTask(const std::string &name, GenericAsyncTask::TaskFunc *function, void *user_data) : AsyncTask(name), _function(function), _user_data(user_data) diff --git a/panda/src/event/pointerEvent.cxx b/panda/src/event/pointerEvent.cxx index 8e64a3c58b..7ee7d3621c 100644 --- a/panda/src/event/pointerEvent.cxx +++ b/panda/src/event/pointerEvent.cxx @@ -19,7 +19,7 @@ * */ void PointerEvent:: -output(ostream &out) const { +output(std::ostream &out) const { out << (_in_window ? "In@" : "Out@") << _xpos << "," << _ypos << " "; } diff --git a/panda/src/event/pointerEventList.cxx b/panda/src/event/pointerEventList.cxx index fc376bc886..4c9d8472c2 100644 --- a/panda/src/event/pointerEventList.cxx +++ b/panda/src/event/pointerEventList.cxx @@ -48,7 +48,7 @@ INLINE double normalize_angle(double angle) { * */ void PointerEventList:: -output(ostream &out) const { +output(std::ostream &out) const { if (_events.empty()) { out << "(no pointers)"; } else { @@ -68,7 +68,7 @@ output(ostream &out) const { * */ void PointerEventList:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << _events.size() << " events:\n"; Events::const_iterator ei; for (ei = _events.begin(); ei != _events.end(); ++ei) { @@ -172,7 +172,7 @@ total_turns(double sec) const { * to be in order to be considered significant. */ double PointerEventList:: -match_pattern(const string &ascpat, double rot, double seglen) { +match_pattern(const std::string &ascpat, double rot, double seglen) { // Convert the pattern from ascii to a more usable form. vector_double pattern; parse_pattern(ascpat, pattern); @@ -189,7 +189,7 @@ match_pattern(const string &ascpat, double rot, double seglen) { * Parses a pattern as used by match_pattern. */ void PointerEventList:: -parse_pattern(const string &ascpat, vector_double &pattern) { +parse_pattern(const std::string &ascpat, vector_double &pattern) { int chars = 0; double dir = 180.0; for (size_t i=0; i= 3 PyObject *str = PyObject_ASCII(result); if (str == nullptr) { @@ -742,7 +742,7 @@ do_python_task() { #endif Py_DECREF(str); Py_DECREF(result); - string message = strm.str(); + std::string message = strm.str(); nassert_raise(message); return DS_interrupt; diff --git a/panda/src/event/test_task.cxx b/panda/src/event/test_task.cxx index 958742f747..e8cc5cb5ef 100644 --- a/panda/src/event/test_task.cxx +++ b/panda/src/event/test_task.cxx @@ -16,9 +16,11 @@ #include "asyncTaskManager.h" #include "perlinNoise2.h" +using std::cerr; + class MyTask : public AsyncTask { public: - MyTask(const string &name, double length, int repeat_count) : + MyTask(const std::string &name, double length, int repeat_count) : AsyncTask(name), _length(length), _repeat_count(repeat_count) @@ -62,12 +64,12 @@ main(int argc, char *argv[]) { cerr << "Making tasks.\n"; for (int yi = 0; yi < grid_size; ++yi) { for (int xi = 0; xi < grid_size; ++xi) { - ostringstream namestrm; + std::ostringstream namestrm; namestrm << "task_" << xi << "_" << yi; - double length = max(length_noise.noise(xi, yi) + 1.0, 0.0); - double delay = max(delay_noise.noise(xi, yi), 0.0) * 3.0; - int repeat_count = (int)floor(max(repeat_count_noise.noise(xi, yi) + 1.0, 0.0) * 1.5); + double length = std::max(length_noise.noise(xi, yi) + 1.0, 0.0); + double delay = std::max(delay_noise.noise(xi, yi), 0.0) * 3.0; + int repeat_count = (int)floor(std::max(repeat_count_noise.noise(xi, yi) + 1.0, 0.0) * 1.5); int sort = (int)floor(sort_noise.noise(xi, yi) * 2.0); int priority = (int)floor(priority_noise.noise(xi, yi) * 5.0); diff --git a/panda/src/express/checksumHashGenerator.cxx b/panda/src/express/checksumHashGenerator.cxx index fbcf1b7563..0de99789fd 100644 --- a/panda/src/express/checksumHashGenerator.cxx +++ b/panda/src/express/checksumHashGenerator.cxx @@ -17,9 +17,9 @@ * Adds a string to the hash, by breaking it down into a sequence of integers. */ void ChecksumHashGenerator:: -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); } diff --git a/panda/src/express/compress_string.cxx b/panda/src/express/compress_string.cxx index 4d1069e34c..d4c08ddb39 100644 --- a/panda/src/express/compress_string.cxx +++ b/panda/src/express/compress_string.cxx @@ -18,6 +18,12 @@ #include "virtualFileSystem.h" #include "config_express.h" +using std::istream; +using std::istringstream; +using std::ostream; +using std::ostringstream; +using std::string; + /** * Compress the indicated source string at the given compression level (1 * through 9). Returns the compressed string. diff --git a/panda/src/express/copy_stream.cxx b/panda/src/express/copy_stream.cxx index 77d0e78364..e04e681772 100644 --- a/panda/src/express/copy_stream.cxx +++ b/panda/src/express/copy_stream.cxx @@ -19,7 +19,7 @@ * true on success, false on failure. */ bool -copy_stream(istream &source, ostream &dest) { +copy_stream(std::istream &source, std::ostream &dest) { static const size_t buffer_size = 4096; char buffer[buffer_size]; diff --git a/panda/src/express/datagram.cxx b/panda/src/express/datagram.cxx index 826a261f93..de7d4089dc 100644 --- a/panda/src/express/datagram.cxx +++ b/panda/src/express/datagram.cxx @@ -41,7 +41,7 @@ clear() { * hex (and ASCII) values. */ void Datagram:: -dump_hex(ostream &out, unsigned int indent) const { +dump_hex(std::ostream &out, unsigned int indent) const { const char *message = (const char *)get_data(); size_t num_bytes = get_length(); for (size_t line = 0; line < num_bytes; line += 16) { @@ -80,13 +80,13 @@ dump_hex(ostream &out, unsigned int indent) const { * Adds a variable-length wstring to the datagram. */ void Datagram:: -add_wstring(const wstring &str) { +add_wstring(const std::wstring &str) { // By convention, wstrings are marked with 32-bit lengths. add_uint32((uint32_t)str.length()); // Now append each character in the string. We store each code little- // endian, for no real good reason. - wstring::const_iterator ci; + std::wstring::const_iterator ci; for (ci = str.begin(); ci != str.end(); ++ci) { add_uint16((uint16_t)*ci); } @@ -168,7 +168,7 @@ assign(const void *data, size_t size) { * Write a string representation of this instance to . */ void Datagram:: -output(ostream &out) const { +output(std::ostream &out) const { #ifndef NDEBUG //[ out<<""<<"Datagram"; #endif //] NDEBUG @@ -178,7 +178,7 @@ output(ostream &out) const { * Write a string representation of this instance to . */ void Datagram:: -write(ostream &out, unsigned int indent) const { +write(std::ostream &out, unsigned int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""<<"Datagram:\n"; diff --git a/panda/src/express/datagramGenerator.cxx b/panda/src/express/datagramGenerator.cxx index 08d792bd70..275a050e88 100644 --- a/panda/src/express/datagramGenerator.cxx +++ b/panda/src/express/datagramGenerator.cxx @@ -86,7 +86,7 @@ get_vfile() { * pointing to the first byte following the datagram returned after a call to * get_datagram(). */ -streampos DatagramGenerator:: +std::streampos DatagramGenerator:: get_file_pos() { return 0; } diff --git a/panda/src/express/datagramIterator.cxx b/panda/src/express/datagramIterator.cxx index 4006ec1eea..680ead3a66 100644 --- a/panda/src/express/datagramIterator.cxx +++ b/panda/src/express/datagramIterator.cxx @@ -14,6 +14,9 @@ #include "datagramIterator.h" #include "pnotify.h" +using std::string; +using std::wstring; + TypeHandle DatagramIterator::_type_handle; /** @@ -156,7 +159,7 @@ extract_bytes(unsigned char *into, size_t size) { * Write a string representation of this instance to . */ void DatagramIterator:: -output(ostream &out) const { +output(std::ostream &out) const { #ifndef NDEBUG //[ out<<""<<"DatagramIterator"; #endif //] NDEBUG @@ -166,7 +169,7 @@ output(ostream &out) const { * Write a string representation of this instance to . */ void DatagramIterator:: -write(ostream &out, unsigned int indent) const { +write(std::ostream &out, unsigned int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""<<"DatagramIterator:\n"; out.width(indent+2); out<<""<<"_current_index "<<_current_index; diff --git a/panda/src/express/datagramSink.cxx b/panda/src/express/datagramSink.cxx index 5b451d3bb2..bdf2be596c 100644 --- a/panda/src/express/datagramSink.cxx +++ b/panda/src/express/datagramSink.cxx @@ -80,7 +80,7 @@ get_file() { * pointing to the first byte following the datagram returned after a call to * put_datagram(). */ -streampos DatagramSink:: +std::streampos DatagramSink:: get_file_pos() { return 0; } diff --git a/panda/src/express/encrypt_string.cxx b/panda/src/express/encrypt_string.cxx index be2100cee8..6c400d77f7 100644 --- a/panda/src/express/encrypt_string.cxx +++ b/panda/src/express/encrypt_string.cxx @@ -18,6 +18,12 @@ #include "virtualFileSystem.h" #include "config_express.h" +using std::istream; +using std::istringstream; +using std::ostream; +using std::ostringstream; +using std::string; + /** * Encrypts the indicated source string using the given password, and the * algorithm specified by encryption-algorithm. Returns the encrypted string. diff --git a/panda/src/express/error_utils.cxx b/panda/src/express/error_utils.cxx index 8a1ec79331..8509856f18 100644 --- a/panda/src/express/error_utils.cxx +++ b/panda/src/express/error_utils.cxx @@ -21,6 +21,8 @@ #include #endif +using std::string; + /** * */ @@ -229,7 +231,7 @@ string handle_socket_error() { errmsg = strerror(errno); default: if (express_cat.is_debug()) - express_cat.debug() << "handle_socket_error - unknown error: " << err << endl; + express_cat.debug() << "handle_socket_error - unknown error: " << err << std::endl; errmsg = "Unknown WSA error"; } @@ -282,12 +284,12 @@ get_network_error() { if (express_cat.is_debug()) express_cat.debug() << "get_network_error() - WSA error = 0 - error : " - << strerror(errno) << endl; + << strerror(errno) << std::endl; return EU_error_abort; default: if (express_cat.is_debug()) express_cat.debug() - << "get_network_error() - unknown error: " << err << endl; + << "get_network_error() - unknown error: " << err << std::endl; return EU_error_abort; } #endif diff --git a/panda/src/express/hashVal.cxx b/panda/src/express/hashVal.cxx index 797ead2ed2..3d2e6f42f5 100644 --- a/panda/src/express/hashVal.cxx +++ b/panda/src/express/hashVal.cxx @@ -20,6 +20,12 @@ #include "openssl/md5.h" #endif // HAVE_OPENSSL +using std::istream; +using std::istringstream; +using std::ostream; +using std::ostringstream; +using std::string; + /** * Outputs the HashVal as a 32-digit hexadecimal number. @@ -53,7 +59,7 @@ input_hex(istream &in) { } if (i != 32) { - in.clear(ios::failbit|in.rdstate()); + in.clear(std::ios::failbit|in.rdstate()); return; } @@ -203,7 +209,7 @@ hash_stream(istream &stream) { char buffer[buffer_size]; // Seek the stream to the beginning in case it wasn't there already. - stream.seekg(0, ios::beg); + stream.seekg(0, std::ios::beg); stream.read(buffer, buffer_size); size_t count = stream.gcount(); diff --git a/panda/src/express/make_ca_bundle.cxx b/panda/src/express/make_ca_bundle.cxx index a619a0a9f1..0773bb88ec 100644 --- a/panda/src/express/make_ca_bundle.cxx +++ b/panda/src/express/make_ca_bundle.cxx @@ -15,6 +15,10 @@ #include "openSSLWrapper.h" #include +using std::cerr; +using std::stringstream; +using std::string; + static const char *source_filename = "ca-bundle.crt"; static const char *target_filename = "ca_bundle_data_src.c"; @@ -45,7 +49,7 @@ main(int argc, char *argv[]) { << " entries.\n"; // Now convert the certificates to DER form. - stringstream der_stream; + std::stringstream der_stream; int cert_count = 0; int num_entries = sk_X509_INFO_num(inf); @@ -78,7 +82,7 @@ main(int argc, char *argv[]) { } der_stream.seekg(0); - istream &in = der_stream; + std::istream &in = der_stream; string table_type = "const unsigned char "; string length_type = "const int "; @@ -99,7 +103,7 @@ main(int argc, char *argv[]) { << " * in DER form, for compiling into OpenSSLWrapper.\n" << " */\n\n" << static_keyword << table_type << table_name << "[] = {"; - out << hex << setfill('0'); + out << std::hex << std::setfill('0'); int count = 0; int col = 0; unsigned int ch; @@ -113,14 +117,14 @@ main(int argc, char *argv[]) { } else { out << ", "; } - out << "0x" << setw(2) << ch; + out << "0x" << std::setw(2) << ch; col++; count++; ch = in.get(); } out << "\n};\n\n" << static_keyword << length_type << table_name << "_len = " - << dec << count << ";\n\n"; + << std::dec << count << ";\n\n"; cerr << "Wrote " << cert_count << " certificates to " << target_filename << "\n"; diff --git a/panda/src/express/memoryUsage.cxx b/panda/src/express/memoryUsage.cxx index d38ac0c77e..b76ae0ed3e 100644 --- a/panda/src/express/memoryUsage.cxx +++ b/panda/src/express/memoryUsage.cxx @@ -27,6 +27,8 @@ #include #include +using std::pair; + MemoryUsage *MemoryUsage::_global_ptr; // This flag is used to protect the operator newdelete handlers against @@ -79,7 +81,7 @@ show() const { #ifdef DO_MEMORY_USAGE // First, copy the relevant information to a vector so we can sort by // counts. Don't use a pvector. - typedef vector CountSorter; + typedef std::vector CountSorter; CountSorter count_sorter; Counts::const_iterator ci; for (ci = _counts.begin(); ci != _counts.end(); ++ci) { diff --git a/panda/src/express/memoryUsagePointerCounts.cxx b/panda/src/express/memoryUsagePointerCounts.cxx index b91be61bcc..8ce69872d6 100644 --- a/panda/src/express/memoryUsagePointerCounts.cxx +++ b/panda/src/express/memoryUsagePointerCounts.cxx @@ -34,7 +34,7 @@ add_info(MemoryInfo *info) { * */ void MemoryUsagePointerCounts:: -output(ostream &out) const { +output(std::ostream &out) const { #ifdef DO_MEMORY_USAGE out << _count << " pointers"; if (_unknown_size_count < _count) { @@ -56,7 +56,7 @@ output(ostream &out) const { * units. */ void MemoryUsagePointerCounts:: -output_bytes(ostream &out, size_t size) { +output_bytes(std::ostream &out, size_t size) { #ifdef DO_MEMORY_USAGE if (size < 4 * 1024) { out << size << " bytes"; diff --git a/panda/src/express/memoryUsagePointers.cxx b/panda/src/express/memoryUsagePointers.cxx index dd412958da..065519bc0c 100644 --- a/panda/src/express/memoryUsagePointers.cxx +++ b/panda/src/express/memoryUsagePointers.cxx @@ -111,7 +111,7 @@ get_type(size_t n) const { /** * Returns the type name of the nth pointer, if it is known. */ -string MemoryUsagePointers:: +std::string MemoryUsagePointers:: get_type_name(size_t n) const { #ifdef DO_MEMORY_USAGE nassertr(n < get_num_pointers(), ""); @@ -150,7 +150,7 @@ clear() { * */ void MemoryUsagePointers:: -output(ostream &out) const { +output(std::ostream &out) const { #ifdef DO_MEMORY_USAGE out << _entries.size() << " pointers."; #endif diff --git a/panda/src/express/multifile.cxx b/panda/src/express/multifile.cxx index 064262747a..e625861f87 100644 --- a/panda/src/express/multifile.cxx +++ b/panda/src/express/multifile.cxx @@ -28,6 +28,19 @@ #include "openSSLWrapper.h" +using std::ios; +using std::iostream; +using std::istream; +using std::max; +using std::min; +using std::ostream; +using std::ostringstream; +using std::streamoff; +using std::streampos; +using std::streamsize; +using std::stringstream; +using std::string; + // This sequence of bytes begins each Multifile to identify it as a Multifile. const char Multifile::_header[] = "pmf\0\n\r"; const size_t Multifile::_header_size = 6; @@ -1997,7 +2010,7 @@ add_new_subfile(Subfile *subfile, int compression_level) { _needs_repack = true; } - pair insert_result = _subfiles.insert(subfile); + std::pair insert_result = _subfiles.insert(subfile); if (!insert_result.second) { // Hmm, unable to insert. There must already be a subfile by that name. // Remove the old one. diff --git a/panda/src/express/openSSLWrapper.cxx b/panda/src/express/openSSLWrapper.cxx index 97fe936d21..d71818e130 100644 --- a/panda/src/express/openSSLWrapper.cxx +++ b/panda/src/express/openSSLWrapper.cxx @@ -63,7 +63,7 @@ OpenSSLWrapper() { int num_certs = ssl_certificates.get_num_unique_values(); for (int ci = 0; ci < num_certs; ci++) { - string cert_file = ssl_certificates.get_unique_value(ci); + std::string cert_file = ssl_certificates.get_unique_value(ci); Filename filename = Filename::expand_from(cert_file); load_certificates(filename); } @@ -108,7 +108,7 @@ load_certificates(const Filename &filename) { VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr(); // First, read the complete file into memory. - string data; + std::string data; if (!vfs->read_file(filename, data, true)) { // Could not find or read file. express_cat.info() diff --git a/panda/src/express/password_hash.cxx b/panda/src/express/password_hash.cxx index a3385013df..b061904965 100644 --- a/panda/src/express/password_hash.cxx +++ b/panda/src/express/password_hash.cxx @@ -21,6 +21,8 @@ #include "openssl/evp.h" #include "memoryHook.h" +using std::string; + /** * Generates a non-reversible hash of a particular length based on an * arbitrary password and a random salt. This is much stronger than the diff --git a/panda/src/express/patchfile.cxx b/panda/src/express/patchfile.cxx index 9c0ebc9481..4c6d9984f4 100644 --- a/panda/src/express/patchfile.cxx +++ b/panda/src/express/patchfile.cxx @@ -35,6 +35,14 @@ istream *Patchfile::_tar_istream = nullptr; #endif // HAVE_TAR +using std::endl; +using std::ios; +using std::istream; +using std::min; +using std::ostream; +using std::streampos; +using std::string; + // this actually slows things down... #define // USE_MD5_FOR_HASHTABLE_INDEX_VALUES diff --git a/panda/src/express/profileTimer.cxx b/panda/src/express/profileTimer.cxx index 78df0afbd4..dfad4b03b4 100644 --- a/panda/src/express/profileTimer.cxx +++ b/panda/src/express/profileTimer.cxx @@ -13,6 +13,9 @@ #include "pmap.h" +using std::ostream; +using std::string; + // See ProfileTimer.h for documentation. @@ -127,7 +130,7 @@ consolidateTo(ostream &out) const { << std::setiosflags(std::ios::fixed) << std::setprecision(6) << total << " seconds]\n" << "-------------------------------------------------------------------\n"; - out << endl; + out << std::endl; } void ProfileTimer:: @@ -156,7 +159,7 @@ printTo(ostream &out) const { << std::setiosflags(std::ios::fixed) << std::setprecision(6) << total << " seconds]\n" << "-------------------------------------------------------------------\n"; - out << endl; + out << std::endl; } ProfileTimer::AutoTimer::AutoTimer(ProfileTimer& profile, const char* tag) : diff --git a/panda/src/express/ramfile.cxx b/panda/src/express/ramfile.cxx index cc12e239c7..c1994df34c 100644 --- a/panda/src/express/ramfile.cxx +++ b/panda/src/express/ramfile.cxx @@ -21,10 +21,10 @@ * The interface here is intentionally designed to be similar to that for * Python's file.read() function. */ -string Ramfile:: +std::string Ramfile:: read(size_t length) { size_t orig_pos = _pos; - _pos = min(_pos + length, _data.length()); + _pos = std::min(_pos + length, _data.length()); return _data.substr(orig_pos, length); } @@ -36,7 +36,7 @@ read(size_t length) { * The interface here is intentionally designed to be similar to that for * Python's file.readline() function. */ -string Ramfile:: +std::string Ramfile:: readline() { size_t start = _pos; while (_pos < _data.length() && _data[_pos] != '\n') { diff --git a/panda/src/express/ramfile_ext.cxx b/panda/src/express/ramfile_ext.cxx index c52641abca..fc1047487c 100644 --- a/panda/src/express/ramfile_ext.cxx +++ b/panda/src/express/ramfile_ext.cxx @@ -23,8 +23,8 @@ PyObject *Extension:: read(size_t length) { size_t data_length = _this->get_data_size(); const char *data = _this->_data.data() + _this->_pos; - length = min(length, data_length - _this->_pos); - _this->_pos = min(_this->_pos + length, data_length); + length = std::min(length, data_length - _this->_pos); + _this->_pos = std::min(_this->_pos + length, data_length); #if PY_MAJOR_VERSION >= 3 return PyBytes_FromStringAndSize((char *)data, length); @@ -43,7 +43,7 @@ read(size_t length) { */ PyObject *Extension:: readline() { - string line = _this->readline(); + std::string line = _this->readline(); #if PY_MAJOR_VERSION >= 3 return PyBytes_FromStringAndSize(line.data(), line.size()); #else @@ -62,7 +62,7 @@ readlines() { return nullptr; } - string line = _this->readline(); + std::string line = _this->readline(); while (!line.empty()) { #if PY_MAJOR_VERSION >= 3 PyObject *py_line = PyBytes_FromStringAndSize(line.data(), line.size()); diff --git a/panda/src/express/subStreamBuf.cxx b/panda/src/express/subStreamBuf.cxx index 0a3f44da9e..4d773e359f 100644 --- a/panda/src/express/subStreamBuf.cxx +++ b/panda/src/express/subStreamBuf.cxx @@ -15,6 +15,11 @@ #include "pnotify.h" #include "memoryHook.h" +using std::ios; +using std::streamoff; +using std::streampos; +using std::streamsize; + static const size_t substream_buffer_size = 4096; /** diff --git a/panda/src/express/subfileInfo.cxx b/panda/src/express/subfileInfo.cxx index 07ab4fc7f8..55631b25af 100644 --- a/panda/src/express/subfileInfo.cxx +++ b/panda/src/express/subfileInfo.cxx @@ -17,6 +17,6 @@ * */ void SubfileInfo:: -output(ostream &out) const { +output(std::ostream &out) const { out << "SubfileInfo(" << get_filename() << ", " << _start << ", " << _size << ")"; } diff --git a/panda/src/express/test_ordered_vector.cxx b/panda/src/express/test_ordered_vector.cxx index 1ed3ba9c96..18c0ab6d1d 100644 --- a/panda/src/express/test_ordered_vector.cxx +++ b/panda/src/express/test_ordered_vector.cxx @@ -13,11 +13,13 @@ #include "ordered_vector.h" +using std::cerr; + typedef ov_multiset myvec; void search(myvec &v, int element) { - pair result; + std::pair result; result = v.equal_range(element); size_t count = v.count(element); diff --git a/panda/src/express/test_types.cxx b/panda/src/express/test_types.cxx index 7cc5cf6e61..1bc9bfefd7 100644 --- a/panda/src/express/test_types.cxx +++ b/panda/src/express/test_types.cxx @@ -19,6 +19,9 @@ #include "pnotify.h" +using std::cerr; +using std::string; + class ThatThingie : public TypedObject, public ReferenceCount { public: ThatThingie(const string &name) : _name(name) { diff --git a/panda/src/express/test_zstream.cxx b/panda/src/express/test_zstream.cxx index 34212eb2df..6040aa3ca7 100644 --- a/panda/src/express/test_zstream.cxx +++ b/panda/src/express/test_zstream.cxx @@ -17,6 +17,10 @@ #include +using std::cerr; +using std::cout; +using std::istream; + void stream_decompress(istream &source) { IDecompressStream zstream(&source, false); @@ -42,7 +46,7 @@ stream_compress(istream &source) { void zlib_decompress(istream &source) { // First, read the entire contents into a buffer. - string data; + std::string data; int ch = source.get(); while (!source.eof() && !source.fail()) { @@ -82,7 +86,7 @@ zlib_decompress(istream &source) { void zlib_compress(istream &source) { // First, read the entire contents into a buffer. - string data; + std::string data; int ch = source.get(); while (!source.eof() && !source.fail()) { diff --git a/panda/src/express/trueClock.cxx b/panda/src/express/trueClock.cxx index ea60c5bb1e..f60ddc22dc 100644 --- a/panda/src/express/trueClock.cxx +++ b/panda/src/express/trueClock.cxx @@ -17,6 +17,9 @@ #include // for fabs() +using std::max; +using std::min; + TrueClock *TrueClock::_global_ptr = nullptr; #if defined(WIN32_VC) || defined(WIN64_VC) @@ -169,7 +172,7 @@ TrueClock() { if (_has_high_res) { if (int_frequency <= 0) { clock_cat.error() - << "TrueClock::get_real_time() - frequency is negative!" << endl; + << "TrueClock::get_real_time() - frequency is negative!" << std::endl; _has_high_res = false; } else { @@ -198,7 +201,7 @@ TrueClock() { if (!_has_high_res) { clock_cat.warning() - << "No high resolution clock available." << endl; + << "No high resolution clock available." << std::endl; } } diff --git a/panda/src/express/virtualFile.cxx b/panda/src/express/virtualFile.cxx index 37068adcab..e388d7c704 100644 --- a/panda/src/express/virtualFile.cxx +++ b/panda/src/express/virtualFile.cxx @@ -18,6 +18,11 @@ #include "pvector.h" #include +using std::iostream; +using std::istream; +using std::ostream; +using std::string; + TypeHandle VirtualFile::_type_handle; /** @@ -284,7 +289,7 @@ close_read_write_file(iostream *stream) { * file. Pass in the stream that was returned by open_read_file(); some * implementations may require this stream to determine the size. */ -streamsize VirtualFile:: +std::streamsize VirtualFile:: get_file_size(istream *stream) const { return get_file_size(); } @@ -293,7 +298,7 @@ get_file_size(istream *stream) const { * Returns the current size on disk (or wherever it is) of the file before it * has been opened. */ -streamsize VirtualFile:: +std::streamsize VirtualFile:: get_file_size() const { return 0; } @@ -412,14 +417,14 @@ simple_read_file(istream *in, vector_uchar &result, size_t max_bytes) { static const size_t buffer_size = 4096; char buffer[buffer_size]; - in->read(buffer, min(buffer_size, max_bytes)); + in->read(buffer, std::min(buffer_size, max_bytes)); size_t count = in->gcount(); while (count != 0) { thread_consider_yield(); nassertr(count <= max_bytes, false); result.insert(result.end(), buffer, buffer + count); max_bytes -= count; - in->read(buffer, min(buffer_size, max_bytes)); + in->read(buffer, std::min(buffer_size, max_bytes)); count = in->gcount(); } diff --git a/panda/src/express/virtualFileComposite.cxx b/panda/src/express/virtualFileComposite.cxx index 30a5cbb0d9..63c4f8d569 100644 --- a/panda/src/express/virtualFileComposite.cxx +++ b/panda/src/express/virtualFileComposite.cxx @@ -57,7 +57,7 @@ is_directory() const { */ bool VirtualFileComposite:: scan_local_directory(VirtualFileList *file_list, - const ov_set &mount_points) const { + const ov_set &mount_points) const { bool any_ok = false; Components::const_iterator ci; for (ci = _components.begin(); ci != _components.end(); ++ci) { diff --git a/panda/src/express/virtualFileMount.cxx b/panda/src/express/virtualFileMount.cxx index 6f8a46afda..37e3554ac2 100644 --- a/panda/src/express/virtualFileMount.cxx +++ b/panda/src/express/virtualFileMount.cxx @@ -16,6 +16,11 @@ #include "virtualFileSystem.h" #include "zStream.h" +using std::iostream; +using std::istream; +using std::ostream; +using std::string; + TypeHandle VirtualFileMount::_type_handle; @@ -134,7 +139,7 @@ read_file(const Filename &file, bool do_uncompress, return false; } - streamsize file_size = get_file_size(file, in); + std::streamsize file_size = get_file_size(file, in); if (file_size > 0) { result.reserve((size_t)file_size); } diff --git a/panda/src/express/virtualFileMountAndroidAsset.cxx b/panda/src/express/virtualFileMountAndroidAsset.cxx index fa5fccece3..c9074fe97a 100644 --- a/panda/src/express/virtualFileMountAndroidAsset.cxx +++ b/panda/src/express/virtualFileMountAndroidAsset.cxx @@ -20,6 +20,10 @@ #include #endif +using std::streamoff; +using std::streampos; +using std::streamsize; + TypeHandle VirtualFileMountAndroidAsset::_type_handle; /** @@ -140,7 +144,7 @@ read_file(const Filename &file, bool do_uncompress, * istream on success (which you should eventually delete when you are done * reading). Returns NULL on failure. */ -istream *VirtualFileMountAndroidAsset:: +std::istream *VirtualFileMountAndroidAsset:: open_read_file(const Filename &file) const { AAsset* asset; asset = AAssetManager_open(_asset_mgr, file.c_str(), AASSET_MODE_UNKNOWN); @@ -149,7 +153,7 @@ open_read_file(const Filename &file) const { } AssetStream *stream = new AssetStream(asset); - return (istream *) stream; + return (std::istream *) stream; } /** @@ -158,7 +162,7 @@ open_read_file(const Filename &file) const { * implementations may require this stream to determine the size. */ streamsize VirtualFileMountAndroidAsset:: -get_file_size(const Filename &file, istream *in) const { +get_file_size(const Filename &file, std::istream *in) const { // If it's already open, get the AAsset pointer from the streambuf. const AssetStreamBuf *buf = (const AssetStreamBuf *) in->rdbuf(); off_t length = AAsset_getLength(buf->_asset); diff --git a/panda/src/express/virtualFileMountMultifile.cxx b/panda/src/express/virtualFileMountMultifile.cxx index 1ecd5b7b5e..1c9a0782ba 100644 --- a/panda/src/express/virtualFileMountMultifile.cxx +++ b/panda/src/express/virtualFileMountMultifile.cxx @@ -85,7 +85,7 @@ read_file(const Filename &file, bool do_uncompress, * istream on success (which you should eventually delete when you are done * reading). Returns NULL on failure. */ -istream *VirtualFileMountMultifile:: +std::istream *VirtualFileMountMultifile:: open_read_file(const Filename &file) const { int subfile_index = _multifile->find_subfile(file); if (subfile_index < 0) { @@ -104,8 +104,8 @@ open_read_file(const Filename &file) const { * file. Pass in the stream that was returned by open_read_file(); some * implementations may require this stream to determine the size. */ -streamsize VirtualFileMountMultifile:: -get_file_size(const Filename &file, istream *) const { +std::streamsize VirtualFileMountMultifile:: +get_file_size(const Filename &file, std::istream *) const { int subfile_index = _multifile->find_subfile(file); if (subfile_index < 0) { return 0; @@ -117,7 +117,7 @@ get_file_size(const Filename &file, istream *) const { * Returns the current size on disk (or wherever it is) of the file before it * has been opened. */ -streamsize VirtualFileMountMultifile:: +std::streamsize VirtualFileMountMultifile:: get_file_size(const Filename &file) const { int subfile_index = _multifile->find_subfile(file); if (subfile_index < 0) { @@ -167,7 +167,7 @@ get_system_info(const Filename &file, SubfileInfo &info) { return false; } - streampos start = _multifile->get_subfile_internal_start(subfile_index); + std::streampos start = _multifile->get_subfile_internal_start(subfile_index); size_t length = _multifile->get_subfile_internal_length(subfile_index); info = SubfileInfo(multifile_name, start, length); @@ -189,6 +189,6 @@ scan_directory(vector_string &contents, const Filename &dir) const { * */ void VirtualFileMountMultifile:: -output(ostream &out) const { +output(std::ostream &out) const { out << _multifile->get_multifile_name(); } diff --git a/panda/src/express/virtualFileMountRamdisk.cxx b/panda/src/express/virtualFileMountRamdisk.cxx index 2f1f481b3d..feda85d1f6 100644 --- a/panda/src/express/virtualFileMountRamdisk.cxx +++ b/panda/src/express/virtualFileMountRamdisk.cxx @@ -15,6 +15,11 @@ #include "subStream.h" #include "dcast.h" +using std::iostream; +using std::istream; +using std::ostream; +using std::string; + TypeHandle VirtualFileMountRamdisk::_type_handle; TypeHandle VirtualFileMountRamdisk::FileBase::_type_handle; TypeHandle VirtualFileMountRamdisk::File::_type_handle; @@ -241,7 +246,7 @@ open_write_file(const Filename &file, bool truncate) { // second, since the timer only has a one second precision. The proper // solution to fix this would be to switch to a higher precision // timer everywhere. - f->_timestamp = max(f->_timestamp + 1, time(nullptr)); + f->_timestamp = std::max(f->_timestamp + 1, time(nullptr)); } return new OSubStream(&f->_wrapper, 0, 0); @@ -283,7 +288,7 @@ open_read_write_file(const Filename &file, bool truncate) { f->_data.str(string()); // See open_write_file - f->_timestamp = max(f->_timestamp + 1, time(nullptr)); + f->_timestamp = std::max(f->_timestamp + 1, time(nullptr)); } return new SubStream(&f->_wrapper, 0, 0); @@ -312,7 +317,7 @@ open_read_append_file(const Filename &file) { * file. Pass in the stream that was returned by open_read_file(); some * implementations may require this stream to determine the size. */ -streamsize VirtualFileMountRamdisk:: +std::streamsize VirtualFileMountRamdisk:: get_file_size(const Filename &file, istream *stream) const { _lock.lock(); PT(FileBase) f = _root.do_find_file(file); @@ -329,7 +334,7 @@ get_file_size(const Filename &file, istream *stream) const { * Returns the current size on disk (or wherever it is) of the file before it * has been opened. */ -streamsize VirtualFileMountRamdisk:: +std::streamsize VirtualFileMountRamdisk:: get_file_size(const Filename &file) const { _lock.lock(); PT(FileBase) f = _root.do_find_file(file); diff --git a/panda/src/express/virtualFileMountSystem.cxx b/panda/src/express/virtualFileMountSystem.cxx index 4ef0d32ab1..ebf5fa6645 100644 --- a/panda/src/express/virtualFileMountSystem.cxx +++ b/panda/src/express/virtualFileMountSystem.cxx @@ -14,6 +14,13 @@ #include "virtualFileMountSystem.h" #include "virtualFileSystem.h" +using std::iostream; +using std::istream; +using std::ostream; +using std::streampos; +using std::streamsize; +using std::string; + TypeHandle VirtualFileMountSystem::_type_handle; @@ -297,7 +304,7 @@ get_file_size(const Filename &file, istream *stream) const { streampos orig = stream->tellg(); // Seek to the end and get the stream position there. - stream->seekg(0, ios::end); + stream->seekg(0, std::ios::end); if (stream->fail()) { // Seeking not supported. stream->clear(); @@ -306,7 +313,7 @@ get_file_size(const Filename &file, istream *stream) const { streampos size = stream->tellg(); // Then return to the original point. - stream->seekg(orig, ios::beg); + stream->seekg(orig, std::ios::beg); // Make sure there are no error flags set as a result of the seek. stream->clear(); diff --git a/panda/src/express/virtualFileSimple.cxx b/panda/src/express/virtualFileSimple.cxx index c5810934f9..11ee94cce9 100644 --- a/panda/src/express/virtualFileSimple.cxx +++ b/panda/src/express/virtualFileSimple.cxx @@ -16,6 +16,11 @@ #include "virtualFileList.h" #include "dcast.h" +using std::iostream; +using std::istream; +using std::ostream; +using std::string; + TypeHandle VirtualFileSimple::_type_handle; @@ -308,7 +313,7 @@ close_read_write_file(iostream *stream) { * file. Pass in the stream that was returned by open_read_file(); some * implementations may require this stream to determine the size. */ -streamsize VirtualFileSimple:: +std::streamsize VirtualFileSimple:: get_file_size(istream *stream) const { return _mount->get_file_size(_local_filename, stream); } @@ -317,7 +322,7 @@ get_file_size(istream *stream) const { * Returns the current size on disk (or wherever it is) of the file before it * has been opened. */ -streamsize VirtualFileSimple:: +std::streamsize VirtualFileSimple:: get_file_size() const { return _mount->get_file_size(_local_filename); } diff --git a/panda/src/express/virtualFileSystem.cxx b/panda/src/express/virtualFileSystem.cxx index 0262392216..eb915b566c 100644 --- a/panda/src/express/virtualFileSystem.cxx +++ b/panda/src/express/virtualFileSystem.cxx @@ -25,6 +25,11 @@ #include "executionEnvironment.h" #include "pset.h" +using std::iostream; +using std::istream; +using std::ostream; +using std::string; + VirtualFileSystem *VirtualFileSystem::_global_ptr = nullptr; diff --git a/panda/src/express/windowsRegistry.cxx b/panda/src/express/windowsRegistry.cxx index 29255a5e74..b96091c299 100644 --- a/panda/src/express/windowsRegistry.cxx +++ b/panda/src/express/windowsRegistry.cxx @@ -21,6 +21,8 @@ #endif #include +using std::string; + /** * Sets the registry key to the indicated value as a string. The supplied * string value is automatically converted from whatever encoding is set by @@ -32,7 +34,7 @@ set_string_value(const string &key, const string &name, const string &value, WindowsRegistry::RegLevel rl) { TextEncoder encoder; - wstring wvalue = encoder.decode_text(value); + std::wstring wvalue = encoder.decode_text(value); // Now convert the string to Windows' idea of the correct wide-char // encoding, so we can store it in the registry. This might well be the @@ -152,7 +154,7 @@ get_string_value(const string &key, const string &name, data.data(), data.length(), wide_result, wide_result_len); - wstring wdata(wide_result, wide_result_len); + std::wstring wdata(wide_result, wide_result_len); TextEncoder encoder; string result = encoder.encode_wtext(wdata); diff --git a/panda/src/express/zStreamBuf.cxx b/panda/src/express/zStreamBuf.cxx index c037252895..877254918d 100644 --- a/panda/src/express/zStreamBuf.cxx +++ b/panda/src/express/zStreamBuf.cxx @@ -18,6 +18,10 @@ #include "pnotify.h" #include "config_express.h" +using std::ios; +using std::streamoff; +using std::streampos; + #if !defined(USE_MEMORY_NOWRAPPERS) && !defined(CPPPARSER) // Define functions that hook zlib into panda's memory allocation system. static void * @@ -69,7 +73,7 @@ ZStreamBuf:: * */ void ZStreamBuf:: -open_read(istream *source, bool owns_source) { +open_read(std::istream *source, bool owns_source) { _source = source; _owns_source = owns_source; @@ -120,7 +124,7 @@ close_read() { * */ void ZStreamBuf:: -open_write(ostream *dest, bool owns_dest, int compression_level) { +open_write(std::ostream *dest, bool owns_dest, int compression_level) { _dest = dest; _owns_dest = owns_dest; @@ -392,7 +396,7 @@ write_chars(const char *start, size_t length, int flush) { */ void ZStreamBuf:: show_zlib_error(const char *function, int error_code, z_stream &z) { - stringstream error_line; + std::stringstream error_line; error_line << "zlib error in " << function << ": "; diff --git a/panda/src/ffmpeg/ffmpegVideoCursor.cxx b/panda/src/ffmpeg/ffmpegVideoCursor.cxx index 2536f85e3c..8746540af2 100644 --- a/panda/src/ffmpeg/ffmpegVideoCursor.cxx +++ b/panda/src/ffmpeg/ffmpegVideoCursor.cxx @@ -259,7 +259,7 @@ start_thread() { if (_thread_status == TS_stopped && _max_readahead_frames > 0) { // Get a unique name for the thread's sync name. - ostringstream strm; + std::ostringstream strm; strm << (void *)this; _sync_name = strm.str(); @@ -337,7 +337,7 @@ set_time(double timestamp, int loop_count) { } // No point in trying to position before the first frame. - frame = max(frame, _initial_dts); + frame = std::max(frame, _initial_dts); if (ffmpeg_cat.is_spam() && frame != _current_frame) { ffmpeg_cat.spam() diff --git a/panda/src/ffmpeg/ffmpegVirtualFile.cxx b/panda/src/ffmpeg/ffmpegVirtualFile.cxx index 6acf6debcd..3fd88f640f 100644 --- a/panda/src/ffmpeg/ffmpegVirtualFile.cxx +++ b/panda/src/ffmpeg/ffmpegVirtualFile.cxx @@ -17,6 +17,9 @@ #include "ffmpegVirtualFile.h" #include "virtualFileSystem.h" +using std::streampos; +using std::streamsize; + extern "C" { #include "libavcodec/avcodec.h" #include "libavformat/avformat.h" @@ -202,7 +205,7 @@ int FfmpegVirtualFile:: read_packet(void *opaque, uint8_t *buf, int size) { streampos ssize = (streampos)size; FfmpegVirtualFile *self = (FfmpegVirtualFile *) opaque; - istream *in = self->_in; + std::istream *in = self->_in; // Since we may be simulating a subset of the opened stream, don't allow it // to read past the "end". @@ -228,21 +231,21 @@ read_packet(void *opaque, uint8_t *buf, int size) { int64_t FfmpegVirtualFile:: seek(void *opaque, int64_t pos, int whence) { FfmpegVirtualFile *self = (FfmpegVirtualFile *) opaque; - istream *in = self->_in; + std::istream *in = self->_in; switch (whence) { case SEEK_SET: - in->seekg(self->_start + (streampos)pos, ios::beg); + in->seekg(self->_start + (streampos)pos, std::ios::beg); break; case SEEK_CUR: - in->seekg(pos, ios::cur); + in->seekg(pos, std::ios::cur); break; case SEEK_END: // For seeks relative to the end, we actually compute the end based on // _start + _size, and then use ios::beg. - in->seekg(self->_start + (streampos)self->_size + (streampos)pos, ios::beg); + in->seekg(self->_start + (streampos)self->_size + (streampos)pos, std::ios::beg); break; case AVSEEK_SIZE: diff --git a/panda/src/framework/pandaFramework.cxx b/panda/src/framework/pandaFramework.cxx index 9179aa02f4..4dfbaee572 100644 --- a/panda/src/framework/pandaFramework.cxx +++ b/panda/src/framework/pandaFramework.cxx @@ -37,6 +37,8 @@ #endif #endif +using std::string; + LoaderOptions PandaFramework::_loader_options; /** @@ -535,7 +537,7 @@ get_models() { * Reports the currently measured average frame rate to the indicated ostream. */ void PandaFramework:: -report_frame_rate(ostream &out) const { +report_frame_rate(std::ostream &out) const { double now = ClockObject::get_global_clock()->get_frame_time(); double delta = now - _start_time; @@ -1175,10 +1177,10 @@ event_arrow_right(const Event *, void *data) { void PandaFramework:: event_S(const Event *, void *) { #ifdef DO_PSTATS - nout << "Connecting to stats host" << endl; + nout << "Connecting to stats host" << std::endl; PStatClient::connect(); #else - nout << "Stats host not supported." << endl; + nout << "Stats host not supported." << std::endl; #endif } @@ -1219,7 +1221,7 @@ event_f9(const Event *event, void *data) { self->_screenshot_text.set_scale(0.06); self->_screenshot_text.set_pos(0.0, 0.0, -0.7); self->_screenshot_text.reparent_to(wf->get_aspect_2d()); - cout << "Screenshot saved: " + output_text + "\n"; + std::cout << "Screenshot saved: " + output_text + "\n"; // Set a do-later to remove the text in 3 seconds. self->_task_mgr.remove(self->_task_mgr.find_tasks("clear_text")); @@ -1273,7 +1275,7 @@ event_question(const Event *event, void *data) { } else { // Build up a string to display. - ostringstream help; + std::ostringstream help; KeyDefinitions::const_iterator ki; for (ki = self->_key_definitions.begin(); ki != self->_key_definitions.end(); @@ -1294,7 +1296,7 @@ event_question(const Event *event, void *data) { LVecBase4 frame = text_node->get_frame_actual(); PN_stdfloat height = frame[3] - frame[2]; - PN_stdfloat scale = min(0.06, 1.8 / height); + PN_stdfloat scale = std::min(0.06, 1.8 / height); self->_help_text.set_scale(scale); PN_stdfloat pos_scale = scale / -2.0; diff --git a/panda/src/framework/windowFramework.cxx b/panda/src/framework/windowFramework.cxx index 3b1cb1807c..1a6c8b1d77 100644 --- a/panda/src/framework/windowFramework.cxx +++ b/panda/src/framework/windowFramework.cxx @@ -62,6 +62,10 @@ // shuttle_controls.bam_src.c. #include "shuttle_controls.bam_src.c" +using std::istringstream; +using std::ostringstream; +using std::string; + // This number is chosen arbitrarily to override any settings in model files. static const int override_priority = 100; @@ -514,15 +518,15 @@ center_trackball(const NodePath &object) { if (lens != nullptr) { LVecBase2 fov = lens->get_fov(); - distance = radius / ctan(deg_2_rad(min(fov[0], fov[1]) / 2.0f)); + distance = radius / ctan(deg_2_rad(std::min(fov[0], fov[1]) / 2.0f)); // Ensure the far plane is far enough back to see the entire object. PN_stdfloat ideal_far_plane = distance + radius * 1.5; - lens->set_far(max(lens->get_default_far(), ideal_far_plane)); + lens->set_far(std::max(lens->get_default_far(), ideal_far_plane)); // And that the near plane is far enough forward. PN_stdfloat ideal_near_plane = distance - radius; - lens->set_near(min(lens->get_default_near(), ideal_near_plane)); + lens->set_near(std::min(lens->get_default_near(), ideal_near_plane)); } _trackball->set_origin(center); diff --git a/panda/src/glstuff/glCgShaderContext_src.cxx b/panda/src/glstuff/glCgShaderContext_src.cxx index d70b2a4a1a..353c68dc46 100644 --- a/panda/src/glstuff/glCgShaderContext_src.cxx +++ b/panda/src/glstuff/glCgShaderContext_src.cxx @@ -508,7 +508,7 @@ issue_parameters(int altered) { if (GLCAT.is_spam()) { GLCAT.spam() << "Setting uniforms for " << _shader->get_filename() - << " (altered 0x" << hex << altered << dec << ")\n"; + << " (altered 0x" << std::hex << altered << std::dec << ")\n"; } // We have no way to track modifications to PTAs, so we assume that they are @@ -737,7 +737,7 @@ update_transform_table(const TransformTable *table) { int i = 0; if (table != nullptr) { - int num_transforms = min(_transform_table_size, (long)table->get_num_transforms()); + int num_transforms = std::min(_transform_table_size, (long)table->get_num_transforms()); for (; i < num_transforms; ++i) { #ifdef STDFLOAT_DOUBLE LMatrix4 matrix; @@ -765,7 +765,7 @@ update_slider_table(const SliderTable *table) { memset(sliders, 0, _slider_table_size * 4); if (table != nullptr) { - int num_sliders = min(_slider_table_size, (long)table->get_num_sliders()); + int num_sliders = std::min(_slider_table_size, (long)table->get_num_sliders()); for (int i = 0; i < num_sliders; ++i) { sliders[i] = table->get_slider(i)->get_slider(); } @@ -880,7 +880,7 @@ update_shader_vertex_arrays(ShaderContext *prev, bool force) { // limited in the options we can set. GLenum type = _glgsg->get_numeric_type(numeric_type); if (p >= 0) { - max_p = max(max_p, (GLuint)p + 1); + max_p = std::max(max_p, (GLuint)p + 1); _glgsg->enable_vertex_attrib_array(p); diff --git a/panda/src/glstuff/glGraphicsBuffer_src.cxx b/panda/src/glstuff/glGraphicsBuffer_src.cxx index 8d77e56086..cba097ad34 100644 --- a/panda/src/glstuff/glGraphicsBuffer_src.cxx +++ b/panda/src/glstuff/glGraphicsBuffer_src.cxx @@ -13,6 +13,9 @@ #include "depthWriteAttrib.h" +using std::max; +using std::min; + TypeHandle CLP(GraphicsBuffer)::_type_handle; /** @@ -20,7 +23,7 @@ TypeHandle CLP(GraphicsBuffer)::_type_handle; */ CLP(GraphicsBuffer):: CLP(GraphicsBuffer)(GraphicsEngine *engine, GraphicsPipe *pipe, - const string &name, + const std::string &name, const FrameBufferProperties &fb_prop, const WindowProperties &win_prop, int flags, @@ -67,7 +70,7 @@ CLP(GraphicsBuffer):: // unshare all buffers that are sharing this object's depth buffer { CLP(GraphicsBuffer) *graphics_buffer; - list ::iterator graphics_buffer_iterator; + std::list ::iterator graphics_buffer_iterator; graphics_buffer_iterator = _shared_depth_buffer_list.begin(); while (graphics_buffer_iterator != _shared_depth_buffer_list.end()) { @@ -495,7 +498,7 @@ rebuild_bitplanes() { } else if (attach[RTP_depth_stencil] != nullptr && attach[RTP_depth] == nullptr) { // The depth stencil slot was assigned a texture, but we don't support it. // Downgrade to a regular depth texture. - swap(attach[RTP_depth], attach[RTP_depth_stencil]); + std::swap(attach[RTP_depth], attach[RTP_depth_stencil]); } // Knowing this, we can already be a tiny bit more accurate about the @@ -537,9 +540,9 @@ rebuild_bitplanes() { if (glgsg->_use_object_labels) { // Assign a label for OpenGL to use when displaying debug messages. if (num_fbos > 1) { - ostringstream strm; + std::ostringstream strm; strm << _name << '[' << layer << ']'; - string name = strm.str(); + std::string name = strm.str(); glgsg->_glObjectLabel(GL_FRAMEBUFFER, _fbo[layer], name.size(), name.data()); } else { glgsg->_glObjectLabel(GL_FRAMEBUFFER, _fbo[layer], _name.size(), _name.data()); @@ -1775,7 +1778,7 @@ resolve_multisamples() { if (_shared_depth_buffer) { CLP(GraphicsBuffer) *graphics_buffer = nullptr; //CLP(GraphicsBuffer) *highest_sort_graphics_buffer = NULL; - list ::iterator graphics_buffer_iterator; + std::list ::iterator graphics_buffer_iterator; int max_sort_order = 0; for (graphics_buffer_iterator = _shared_depth_buffer_list.begin(); diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index 1e4c2bb530..b6790e4931 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -73,6 +73,13 @@ #include +using std::dec; +using std::endl; +using std::hex; +using std::max; +using std::min; +using std::string; + TypeHandle CLP(GraphicsStateGuardian)::_type_handle; PStatCollector CLP(GraphicsStateGuardian)::_load_display_list_pcollector("Draw:Transfer data:Display lists"); @@ -7836,7 +7843,7 @@ bind_light(DirectionalLight *light_obj, const NodePath &light, int light_id) { // State:Light:Bind:Directional"); PStatGPUTimer timer(this, // _draw_set_state_light_bind_directional_pcollector); - pair lookup = _dlights.insert(DirectionalLights::value_type(light, DirectionalLightFrameData())); + std::pair lookup = _dlights.insert(DirectionalLights::value_type(light, DirectionalLightFrameData())); DirectionalLightFrameData &fdata = (*lookup.first).second; if (lookup.second) { // The light was not computed yet this frame. Compute it now. @@ -8100,7 +8107,7 @@ get_error_string(GLenum error_code) { } // Other error, somehow? Just display the error code then. - ostringstream strm; + std::ostringstream strm; strm << "GL error " << (int)error_code; return strm.str(); @@ -8307,7 +8314,7 @@ get_extra_extensions() { void CLP(GraphicsStateGuardian):: report_extensions() const { if (GLCAT.is_debug()) { - ostream &out = GLCAT.debug(); + std::ostream &out = GLCAT.debug(); out << "GL Extensions:\n"; pset::const_iterator ei; diff --git a/panda/src/glstuff/glShaderContext_src.cxx b/panda/src/glstuff/glShaderContext_src.cxx index 203cccb727..77c111ad75 100644 --- a/panda/src/glstuff/glShaderContext_src.cxx +++ b/panda/src/glstuff/glShaderContext_src.cxx @@ -27,6 +27,12 @@ #include "clipPlaneAttrib.h" #include "bamCache.h" +using std::dec; +using std::hex; +using std::max; +using std::min; +using std::string; + TypeHandle CLP(ShaderContext)::_type_handle; /** @@ -2799,7 +2805,7 @@ glsl_report_shader_errors(GLuint shader, Shader::ShaderType type, bool fatal) { // Parse the errors so that we can substitute in actual file locations // instead of source indices. - istringstream log(info_log); + std::istringstream log(info_log); string line; while (std::getline(log, line)) { int fileno, lineno, colno; @@ -3114,7 +3120,7 @@ glsl_compile_and_link() { sprintf(filename, "glsl_program%d.dump", gl_dump_count++); pofstream s; - s.open(filename, ios::out | ios::binary | ios::trunc); + s.open(filename, std::ios::out | std::ios::binary | std::ios::trunc); s.write(binary, num_bytes); s.close(); diff --git a/panda/src/glxdisplay/glxGraphicsBuffer.cxx b/panda/src/glxdisplay/glxGraphicsBuffer.cxx index 835adeed97..d777f7a239 100644 --- a/panda/src/glxdisplay/glxGraphicsBuffer.cxx +++ b/panda/src/glxdisplay/glxGraphicsBuffer.cxx @@ -27,7 +27,7 @@ TypeHandle glxGraphicsBuffer::_type_handle; */ glxGraphicsBuffer:: glxGraphicsBuffer(GraphicsEngine *engine, GraphicsPipe *pipe, - const string &name, + const std::string &name, const FrameBufferProperties &fb_prop, const WindowProperties &win_prop, int flags, diff --git a/panda/src/glxdisplay/glxGraphicsPipe.cxx b/panda/src/glxdisplay/glxGraphicsPipe.cxx index 06266e6e96..e4ec8380fb 100644 --- a/panda/src/glxdisplay/glxGraphicsPipe.cxx +++ b/panda/src/glxdisplay/glxGraphicsPipe.cxx @@ -20,6 +20,8 @@ #include "config_glxdisplay.h" #include "frameBufferProperties.h" +using std::string; + TypeHandle glxGraphicsPipe::_type_handle; /** diff --git a/panda/src/glxdisplay/glxGraphicsPixmap.cxx b/panda/src/glxdisplay/glxGraphicsPixmap.cxx index 8c9c317b2c..7f551b8d4f 100644 --- a/panda/src/glxdisplay/glxGraphicsPixmap.cxx +++ b/panda/src/glxdisplay/glxGraphicsPixmap.cxx @@ -28,7 +28,7 @@ TypeHandle glxGraphicsPixmap::_type_handle; */ glxGraphicsPixmap:: glxGraphicsPixmap(GraphicsEngine *engine, GraphicsPipe *pipe, - const string &name, + const std::string &name, const FrameBufferProperties &fb_prop, const WindowProperties &win_prop, int flags, diff --git a/panda/src/glxdisplay/glxGraphicsStateGuardian.cxx b/panda/src/glxdisplay/glxGraphicsStateGuardian.cxx index 2b877b2168..76c66d817e 100644 --- a/panda/src/glxdisplay/glxGraphicsStateGuardian.cxx +++ b/panda/src/glxdisplay/glxGraphicsStateGuardian.cxx @@ -18,6 +18,8 @@ #include +using std::string; + TypeHandle glxGraphicsStateGuardian::_type_handle; diff --git a/panda/src/glxdisplay/glxGraphicsWindow.cxx b/panda/src/glxdisplay/glxGraphicsWindow.cxx index 28f4652266..a7a2472a84 100644 --- a/panda/src/glxdisplay/glxGraphicsWindow.cxx +++ b/panda/src/glxdisplay/glxGraphicsWindow.cxx @@ -36,7 +36,7 @@ TypeHandle glxGraphicsWindow::_type_handle; */ glxGraphicsWindow:: glxGraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe, - const string &name, + const std::string &name, const FrameBufferProperties &fb_prop, const WindowProperties &win_prop, int flags, diff --git a/panda/src/gobj/adaptiveLru.cxx b/panda/src/gobj/adaptiveLru.cxx index 85bb3ab36c..54ed81a3c8 100644 --- a/panda/src/gobj/adaptiveLru.cxx +++ b/panda/src/gobj/adaptiveLru.cxx @@ -16,6 +16,9 @@ #include "clockObject.h" #include "indent.h" +using std::cerr; +using std::ostream; + static const int HIGH_PRIORITY_SCALE = 4; static const int LOW_PRIORITY_RANGE = 25; @@ -23,7 +26,7 @@ static const int LOW_PRIORITY_RANGE = 25; * */ AdaptiveLru:: -AdaptiveLru(const string &name, size_t max_size) : +AdaptiveLru(const std::string &name, size_t max_size) : Namable(name) { _total_size = 0; @@ -156,7 +159,7 @@ update_page(AdaptiveLruPage *page) { } if (target_priority != page->_priority) { - page->_priority = min(max(target_priority, 0), LPP_TotalPriorities - 1); + page->_priority = std::min(std::max(target_priority, 0), LPP_TotalPriorities - 1); ((AdaptiveLruPageDynamicList *)page)->remove_from_list(); ((AdaptiveLruPageDynamicList *)page)->insert_before(&_page_array[page->_priority]); } diff --git a/panda/src/gobj/bufferContextChain.cxx b/panda/src/gobj/bufferContextChain.cxx index 9a94ff2919..4f27c90c88 100644 --- a/panda/src/gobj/bufferContextChain.cxx +++ b/panda/src/gobj/bufferContextChain.cxx @@ -54,7 +54,7 @@ take_from(BufferContextChain &other) { * */ void BufferContextChain:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << _count << " objects, consuming " << _total_size << " bytes:\n"; diff --git a/panda/src/gobj/bufferResidencyTracker.cxx b/panda/src/gobj/bufferResidencyTracker.cxx index abb51610e6..9ac4fef735 100644 --- a/panda/src/gobj/bufferResidencyTracker.cxx +++ b/panda/src/gobj/bufferResidencyTracker.cxx @@ -22,7 +22,7 @@ PStatCollector BufferResidencyTracker::_gmem_collector("Graphics memory"); * */ BufferResidencyTracker:: -BufferResidencyTracker(const string &pgo_name, const string &type_name) : +BufferResidencyTracker(const std::string &pgo_name, const std::string &type_name) : _pgo_collector(_gmem_collector, pgo_name), _active_resident_collector(PStatCollector(_pgo_collector, "Active"), type_name), _active_nonresident_collector(PStatCollector(_pgo_collector, "Thrashing"), type_name), @@ -90,7 +90,7 @@ set_levels() { * */ void BufferResidencyTracker:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { if (_chains[S_inactive_nonresident].get_count() != 0) { indent(out, indent_level) << "Inactive nonresident:\n"; _chains[S_inactive_nonresident].write(out, indent_level + 2); diff --git a/panda/src/gobj/geom.cxx b/panda/src/gobj/geom.cxx index 0c627d6e5b..5cf18838d8 100644 --- a/panda/src/gobj/geom.cxx +++ b/panda/src/gobj/geom.cxx @@ -25,6 +25,9 @@ #include "lightMutexHolder.h" #include "config_mathutil.h" +using std::max; +using std::min; + UpdateSeq Geom::_next_modified; PStatCollector Geom::_draw_primitive_setup_pcollector("Draw:Primitive:Setup"); @@ -625,7 +628,7 @@ unify_in_place(int max_indices, bool preserve_order) { } else { // We have already encountered another primitive of this type. Combine // them. - combine_primitives((*npi).second, move(primitive), current_thread); + combine_primitives((*npi).second, std::move(primitive), current_thread); } } @@ -1060,7 +1063,7 @@ get_nested_vertices(Thread *current_thread) const { * */ void Geom:: -output(ostream &out) const { +output(std::ostream &out) const { CDReader cdata(_cycler); // Get a list of the primitive types contained within this object. @@ -1087,7 +1090,7 @@ output(ostream &out) const { * */ void Geom:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { CDReader cdata(_cycler); // Get a list of the primitive types contained within this object. @@ -1552,9 +1555,9 @@ combine_primitives(GeomPrimitive *a_prim, CPT(GeomPrimitive) b_prim, } PT(GeomVertexArrayDataHandle) a_handle = - new GeomVertexArrayDataHandle(move(a_vertices), current_thread); + new GeomVertexArrayDataHandle(std::move(a_vertices), current_thread); CPT(GeomVertexArrayDataHandle) b_handle = - new GeomVertexArrayDataHandle(move(b_vertices), current_thread); + new GeomVertexArrayDataHandle(std::move(b_vertices), current_thread); size_t orig_a_vertices = a_handle->get_num_rows(); @@ -1672,7 +1675,7 @@ evict_callback() { * */ void Geom::CacheEntry:: -output(ostream &out) const { +output(std::ostream &out) const { out << "geom " << (void *)_source << ", " << (const void *)_key._modifier; } diff --git a/panda/src/gobj/geomCacheEntry.cxx b/panda/src/gobj/geomCacheEntry.cxx index 608ebbdac4..8ddb12b042 100644 --- a/panda/src/gobj/geomCacheEntry.cxx +++ b/panda/src/gobj/geomCacheEntry.cxx @@ -133,6 +133,6 @@ evict_callback() { * */ void GeomCacheEntry:: -output(ostream &out) const { +output(std::ostream &out) const { out << "[ unknown ]"; } diff --git a/panda/src/gobj/geomEnums.cxx b/panda/src/gobj/geomEnums.cxx index e63260a144..0899fd3679 100644 --- a/panda/src/gobj/geomEnums.cxx +++ b/panda/src/gobj/geomEnums.cxx @@ -15,6 +15,10 @@ #include "string_utils.h" #include "config_gobj.h" +using std::istream; +using std::ostream; +using std::string; + /** * diff --git a/panda/src/gobj/geomLines.cxx b/panda/src/gobj/geomLines.cxx index dee3c89ccf..2d38fc8838 100644 --- a/panda/src/gobj/geomLines.cxx +++ b/panda/src/gobj/geomLines.cxx @@ -20,6 +20,8 @@ #include "geomVertexWriter.h" #include "geomLinesAdjacency.h" +using std::map; + TypeHandle GeomLines::_type_handle; /** @@ -125,7 +127,7 @@ make_adjacency() const { nassertr(to.is_at_end(), nullptr); } - adj->set_vertices(move(new_vertices)); + adj->set_vertices(std::move(new_vertices)); return adj.p(); } diff --git a/panda/src/gobj/geomLinestrips.cxx b/panda/src/gobj/geomLinestrips.cxx index 0b54de3410..f6550a0de3 100644 --- a/panda/src/gobj/geomLinestrips.cxx +++ b/panda/src/gobj/geomLinestrips.cxx @@ -20,6 +20,8 @@ #include "graphicsStateGuardianBase.h" #include "geomLinestripsAdjacency.h" +using std::map; + TypeHandle GeomLinestrips::_type_handle; /** diff --git a/panda/src/gobj/geomMunger.cxx b/panda/src/gobj/geomMunger.cxx index 83d57467c1..40a183edfa 100644 --- a/panda/src/gobj/geomMunger.cxx +++ b/panda/src/gobj/geomMunger.cxx @@ -148,7 +148,7 @@ munge_geom(CPT(Geom) &geom, CPT(GeomVertexData) &data, if (entry == nullptr) { // Create a new entry for the result. // We don't need the key anymore, move the pointers into the CacheEntry. - entry = new Geom::CacheEntry(orig_geom, move(key)); + entry = new Geom::CacheEntry(orig_geom, std::move(key)); { LightMutexHolder holder(orig_geom->_cache_lock); @@ -378,7 +378,7 @@ do_unregister() { * */ void GeomMunger::CacheEntry:: -output(ostream &out) const { +output(std::ostream &out) const { out << "munger " << _munger; } diff --git a/panda/src/gobj/geomPrimitive.cxx b/panda/src/gobj/geomPrimitive.cxx index db939d3bef..f52e06663a 100644 --- a/panda/src/gobj/geomPrimitive.cxx +++ b/panda/src/gobj/geomPrimitive.cxx @@ -31,6 +31,9 @@ #include "indent.h" #include "pStatTimer.h" +using std::max; +using std::min; + TypeHandle GeomPrimitive::_type_handle; TypeHandle GeomPrimitive::CData::_type_handle; TypeHandle GeomPrimitivePipelineReader::_type_handle; @@ -581,7 +584,7 @@ pack_vertices(GeomVertexData *dest, const GeomVertexData *source) { // Try to add the relation { v : size() }. If that succeeds, great; if // it doesn't, look up whatever we previously added for v. - pair result = + std::pair result = copied_indices.insert(CopiedIndices::value_type(v, (int)copied_indices.size())); int v2 = (*result.first).second + dest_start; index.add_data1i(v2); @@ -1079,7 +1082,7 @@ request_resident(Thread *current_thread) const { * */ void GeomPrimitive:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type() << ", " << get_num_primitives() << ", " << get_num_vertices(); } @@ -1088,7 +1091,7 @@ output(ostream &out) const { * */ void GeomPrimitive:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << get_type(); if (is_indexed()) { diff --git a/panda/src/gobj/geomTriangles.cxx b/panda/src/gobj/geomTriangles.cxx index 494f59be74..809b9199c0 100644 --- a/panda/src/gobj/geomTriangles.cxx +++ b/panda/src/gobj/geomTriangles.cxx @@ -19,6 +19,8 @@ #include "graphicsStateGuardianBase.h" #include "geomTrianglesAdjacency.h" +using std::map; + TypeHandle GeomTriangles::_type_handle; /** @@ -85,7 +87,7 @@ make_adjacency() const { new_vertices->set_num_rows(num_vertices * 2); // First, build a map of each triangle's halfedges to its opposing vertices. - map, int> edge_map; + map, int> edge_map; for (int i = 0; i < num_vertices; i += 3) { int v0 = from.get_vertex(i); int v1 = from.get_vertex(i + 1); @@ -135,7 +137,7 @@ make_adjacency() const { nassertr(to.is_at_end(), nullptr); } - adj->set_vertices(move(new_vertices)); + adj->set_vertices(std::move(new_vertices)); return adj.p(); } diff --git a/panda/src/gobj/geomTristrips.cxx b/panda/src/gobj/geomTristrips.cxx index 7c8eff61f9..0b88bcf8f1 100644 --- a/panda/src/gobj/geomTristrips.cxx +++ b/panda/src/gobj/geomTristrips.cxx @@ -20,6 +20,8 @@ #include "graphicsStateGuardianBase.h" #include "geomTristripsAdjacency.h" +using std::map; + TypeHandle GeomTristrips::_type_handle; /** @@ -98,7 +100,7 @@ make_adjacency() const { const int num_unused = 2; // First, build a map of each triangle's halfedges to its opposing vertices. - map, int> edge_map; + map, int> edge_map; int vi = -num_unused; int li = 0; diff --git a/panda/src/gobj/geomVertexAnimationSpec.cxx b/panda/src/gobj/geomVertexAnimationSpec.cxx index be4dc6903a..f4560b7980 100644 --- a/panda/src/gobj/geomVertexAnimationSpec.cxx +++ b/panda/src/gobj/geomVertexAnimationSpec.cxx @@ -19,7 +19,7 @@ * */ void GeomVertexAnimationSpec:: -output(ostream &out) const { +output(std::ostream &out) const { switch (_animation_type) { case AT_none: out << "none"; diff --git a/panda/src/gobj/geomVertexArrayData.cxx b/panda/src/gobj/geomVertexArrayData.cxx index b868fc87e0..998ca1ad14 100644 --- a/panda/src/gobj/geomVertexArrayData.cxx +++ b/panda/src/gobj/geomVertexArrayData.cxx @@ -25,6 +25,9 @@ #include "vertexDataBuffer.h" #include "texture.h" +using std::max; +using std::min; + ConfigVariableInt max_independent_vertex_data ("max-independent-vertex-data", -1, PRC_DESC("Specifies the maximum number of bytes of all vertex data " @@ -176,7 +179,7 @@ set_usage_hint(GeomVertexArrayData::UsageHint usage_hint) { * */ void GeomVertexArrayData:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_num_rows() << " rows: " << *get_array_format(); } @@ -184,7 +187,7 @@ output(ostream &out) const { * */ void GeomVertexArrayData:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { _array_format->write_with_data(out, indent_level, this); } diff --git a/panda/src/gobj/geomVertexArrayData_ext.cxx b/panda/src/gobj/geomVertexArrayData_ext.cxx index f35d96ae3a..73c795f0b5 100644 --- a/panda/src/gobj/geomVertexArrayData_ext.cxx +++ b/panda/src/gobj/geomVertexArrayData_ext.cxx @@ -19,7 +19,7 @@ struct InternalBufferData { CPT(GeomVertexArrayDataHandle) _handle; Py_ssize_t _num_rows; Py_ssize_t _stride; - string _format; + std::string _format; }; /** @@ -251,8 +251,8 @@ copy_subdata_from(size_t to_start, size_t to_size, } size_t from_buffer_orig_size = (size_t) view.len; - from_start = min(from_start, from_buffer_orig_size); - from_size = min(from_size, from_buffer_orig_size - from_start); + from_start = std::min(from_start, from_buffer_orig_size); + from_size = std::min(from_size, from_buffer_orig_size - from_start); _this->copy_subdata_from(to_start, to_size, (const unsigned char *) view.buf, diff --git a/panda/src/gobj/geomVertexArrayFormat.cxx b/panda/src/gobj/geomVertexArrayFormat.cxx index 9e0d35cccd..2a82eef81f 100644 --- a/panda/src/gobj/geomVertexArrayFormat.cxx +++ b/panda/src/gobj/geomVertexArrayFormat.cxx @@ -21,6 +21,10 @@ #include "indirectLess.h" #include "lightMutexHolder.h" +using std::max; +using std::min; +using std::move; + GeomVertexArrayFormat::Registry *GeomVertexArrayFormat::_registry = nullptr; TypeHandle GeomVertexArrayFormat::_type_handle; @@ -460,7 +464,7 @@ count_unused_space() const { * */ void GeomVertexArrayFormat:: -output(ostream &out) const { +output(std::ostream &out) const { Columns::const_iterator ci; int last_pos = 0; out << "["; @@ -484,7 +488,7 @@ output(ostream &out) const { * */ void GeomVertexArrayFormat:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << "Array format (stride = " << get_stride() << "):\n"; consider_sort_columns(); @@ -503,7 +507,7 @@ write(ostream &out, int indent_level) const { * */ void GeomVertexArrayFormat:: -write_with_data(ostream &out, int indent_level, +write_with_data(std::ostream &out, int indent_level, const GeomVertexArrayData *array_data) const { consider_sort_columns(); int num_rows = array_data->get_num_rows(); @@ -536,7 +540,7 @@ write_with_data(ostream &out, int indent_level, * the columns in memory, as understood by Python's struct module. If pad is * true, extra padding bytes are added to the end as 'x' characters as needed. */ -string GeomVertexArrayFormat:: +std::string GeomVertexArrayFormat:: get_format_string(bool pad) const { consider_sort_columns(); @@ -616,7 +620,7 @@ get_format_string(bool pad) const { memset((void*) (fmt + fi), 'x', pad); } - string fmt_string (fmt); + std::string fmt_string (fmt); free(fmt); return fmt_string; } diff --git a/panda/src/gobj/geomVertexColumn.cxx b/panda/src/gobj/geomVertexColumn.cxx index b43930d3b5..d04b69a307 100644 --- a/panda/src/gobj/geomVertexColumn.cxx +++ b/panda/src/gobj/geomVertexColumn.cxx @@ -16,6 +16,9 @@ #include "bamReader.h" #include "bamWriter.h" +using std::max; +using std::min; + /** * */ @@ -97,7 +100,7 @@ set_column_alignment(int column_alignment) { * */ void GeomVertexColumn:: -output(ostream &out) const { +output(std::ostream &out) const { out << *get_name() << "(" << get_num_components(); switch (get_numeric_type()) { case NT_uint8: diff --git a/panda/src/gobj/geomVertexData.cxx b/panda/src/gobj/geomVertexData.cxx index f2597614ef..e87e573552 100644 --- a/panda/src/gobj/geomVertexData.cxx +++ b/panda/src/gobj/geomVertexData.cxx @@ -22,6 +22,8 @@ #include "pset.h" #include "indent.h" +using std::ostream; + TypeHandle GeomVertexData::_type_handle; TypeHandle GeomVertexData::CDataCache::_type_handle; TypeHandle GeomVertexData::CacheEntry::_type_handle; @@ -60,7 +62,7 @@ make_cow_copy() { * */ GeomVertexData:: -GeomVertexData(const string &name, +GeomVertexData(const std::string &name, const GeomVertexFormat *format, GeomVertexData::UsageHint usage_hint) : _name(name), @@ -210,7 +212,7 @@ compare_to(const GeomVertexData &other) const { * graph for vertex computations. */ void GeomVertexData:: -set_name(const string &name) { +set_name(const std::string &name) { _name = name; _char_pcollector = PStatCollector(_animation_pcollector, name); _skinning_pcollector = PStatCollector(_char_pcollector, "Skinning"); @@ -761,7 +763,7 @@ convert_to(const GeomVertexFormat *new_format) const { if (entry == nullptr) { // Create a new entry for the result. // We don't need the key anymore, move the pointers into the CacheEntry. - entry = new CacheEntry((GeomVertexData *)this, move(key)); + entry = new CacheEntry((GeomVertexData *)this, std::move(key)); { LightMutexHolder holder(_cache_lock); @@ -969,7 +971,7 @@ animate_vertices(bool force, Thread *current_thread) const { if (!cdata->_transform_blend_table.is_null()) { if (cdata->_slider_table != nullptr) { modified = - max(cdata->_transform_blend_table.get_read_pointer()->get_modified(current_thread), + std::max(cdata->_transform_blend_table.get_read_pointer()->get_modified(current_thread), cdata->_slider_table->get_modified(current_thread)); } else { modified = cdata->_transform_blend_table.get_read_pointer()->get_modified(current_thread); @@ -1316,7 +1318,7 @@ describe_vertex(ostream &out, int row) const { const GeomVertexColumn *column = format->get_column(ci); reader.set_column(ai, column); - int num_values = min(column->get_num_values(), 4); + int num_values = std::min(column->get_num_values(), 4); const LVecBase4 &d = reader.get_data4(); out << " " << *column->get_name(); @@ -1470,7 +1472,7 @@ update_animated_vertices(GeomVertexData::CData *cdata, Thread *current_thread) { new_format = orig_format->get_post_animated_format(); cdata->_animated_vertices = new GeomVertexData(get_name(), new_format, - min(get_usage_hint(), UH_dynamic)); + std::min(get_usage_hint(), UH_dynamic)); } PT(GeomVertexData) new_data = cdata->_animated_vertices; diff --git a/panda/src/gobj/geomVertexFormat.cxx b/panda/src/gobj/geomVertexFormat.cxx index 05814c5bd8..2b3479cc4f 100644 --- a/panda/src/gobj/geomVertexFormat.cxx +++ b/panda/src/gobj/geomVertexFormat.cxx @@ -173,7 +173,7 @@ get_union_format(const GeomVertexFormat *other) const { // D, E) in array 1. In general, a column will appear in the result in the // first array it appears in either of the inputs. - size_t num_arrays = max(_arrays.size(), other->_arrays.size()); + size_t num_arrays = std::max(_arrays.size(), other->_arrays.size()); for (size_t ai = 0; ai < num_arrays; ++ai) { PT(GeomVertexArrayFormat) new_array = new GeomVertexArrayFormat; @@ -565,7 +565,7 @@ maybe_align_columns_for_animation() { * */ void GeomVertexFormat:: -output(ostream &out) const { +output(std::ostream &out) const { if (_arrays.empty()) { out << "(empty)"; @@ -589,7 +589,7 @@ output(ostream &out) const { * */ void GeomVertexFormat:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { for (size_t i = 0; i < _arrays.size(); i++) { indent(out, indent_level) << "Array " << i << ":\n"; @@ -606,7 +606,7 @@ write(ostream &out, int indent_level) const { * */ void GeomVertexFormat:: -write_with_data(ostream &out, int indent_level, +write_with_data(std::ostream &out, int indent_level, const GeomVertexData *data) const { indent(out, indent_level) << data->get_num_rows() << " rows.\n"; @@ -716,7 +716,7 @@ do_register() { int num_columns = array_format->get_num_columns(); for (int i = 0; i < num_columns; i++) { const GeomVertexColumn *column = array_format->get_column(i); - pair result; + std::pair result; result = _columns_by_name.insert(DataTypesByName::value_type(column->get_name(), DataTypeRecord())); if (!result.second) { gobj_cat.warning() diff --git a/panda/src/gobj/geomVertexReader.cxx b/panda/src/gobj/geomVertexReader.cxx index b803095915..00bd42a33f 100644 --- a/panda/src/gobj/geomVertexReader.cxx +++ b/panda/src/gobj/geomVertexReader.cxx @@ -13,7 +13,6 @@ #include "geomVertexReader.h" - #ifndef NDEBUG // This is defined just for the benefit of having something non-NULL to // return from a nassertr() call. @@ -60,7 +59,7 @@ set_column(int array, const GeomVertexColumn *column) { * */ void GeomVertexReader:: -output(ostream &out) const { +output(std::ostream &out) const { const GeomVertexColumn *column = get_column(); if (column == nullptr) { out << "GeomVertexReader()"; diff --git a/panda/src/gobj/geomVertexRewriter.cxx b/panda/src/gobj/geomVertexRewriter.cxx index e1743ca39d..1bad4afd9d 100644 --- a/panda/src/gobj/geomVertexRewriter.cxx +++ b/panda/src/gobj/geomVertexRewriter.cxx @@ -17,7 +17,7 @@ * */ void GeomVertexRewriter:: -output(ostream &out) const { +output(std::ostream &out) const { const GeomVertexColumn *column = get_column(); if (column == nullptr) { out << "GeomVertexRewriter()"; diff --git a/panda/src/gobj/geomVertexWriter.cxx b/panda/src/gobj/geomVertexWriter.cxx index 51e8b91bf5..a433bef9e2 100644 --- a/panda/src/gobj/geomVertexWriter.cxx +++ b/panda/src/gobj/geomVertexWriter.cxx @@ -13,7 +13,6 @@ #include "geomVertexWriter.h" - #ifdef _DEBUG // This is defined just for the benefit of having something non-NULL to // return from a nassertr() call. @@ -92,7 +91,7 @@ reserve_num_rows(int num_rows) { * */ void GeomVertexWriter:: -output(ostream &out) const { +output(std::ostream &out) const { const GeomVertexColumn *column = get_column(); if (column == nullptr) { out << "GeomVertexWriter()"; diff --git a/panda/src/gobj/indexBufferContext.cxx b/panda/src/gobj/indexBufferContext.cxx index ebb65ea89f..2c3e68ba0b 100644 --- a/panda/src/gobj/indexBufferContext.cxx +++ b/panda/src/gobj/indexBufferContext.cxx @@ -19,7 +19,7 @@ TypeHandle IndexBufferContext::_type_handle; * */ void IndexBufferContext:: -output(ostream &out) const { +output(std::ostream &out) const { out << *get_data() << ", " << get_data_size_bytes(); } @@ -27,6 +27,6 @@ output(ostream &out) const { * */ void IndexBufferContext:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { SavedContext::write(out, indent_level); } diff --git a/panda/src/gobj/internalName.cxx b/panda/src/gobj/internalName.cxx index 828b6db97a..6803f9bab8 100644 --- a/panda/src/gobj/internalName.cxx +++ b/panda/src/gobj/internalName.cxx @@ -18,6 +18,8 @@ #include "bamReader.h" #include "preparedGraphicsObjects.h" +using std::string; + PT(InternalName) InternalName::_root; PT(InternalName) InternalName::_error; PT(InternalName) InternalName::_default; @@ -248,7 +250,7 @@ get_net_basename(int n) const { * */ void InternalName:: -output(ostream &out) const { +output(std::ostream &out) const { if (_parent == get_root()) { out << _basename; diff --git a/panda/src/gobj/internalName_ext.cxx b/panda/src/gobj/internalName_ext.cxx index a03651dbf5..4967b330b5 100644 --- a/panda/src/gobj/internalName_ext.cxx +++ b/panda/src/gobj/internalName_ext.cxx @@ -13,6 +13,8 @@ #include "internalName_ext.h" +using std::string; + #ifdef HAVE_PYTHON /** diff --git a/panda/src/gobj/lens.cxx b/panda/src/gobj/lens.cxx index cb7a496e97..470b64447a 100644 --- a/panda/src/gobj/lens.cxx +++ b/panda/src/gobj/lens.cxx @@ -23,6 +23,9 @@ #include "config_gobj.h" #include "plane.h" +using std::max; +using std::min; + TypeHandle Lens::_type_handle; TypeHandle Lens::CData::_type_handle; @@ -676,7 +679,7 @@ make_bounds() const { * */ void Lens:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type(); } @@ -684,7 +687,7 @@ output(ostream &out) const { * */ void Lens:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << get_type() << " fov = " << get_fov() << "\n"; } diff --git a/panda/src/gobj/material.cxx b/panda/src/gobj/material.cxx index 12d4f15365..1952066649 100644 --- a/panda/src/gobj/material.cxx +++ b/panda/src/gobj/material.cxx @@ -395,7 +395,7 @@ compare_to(const Material &other) const { * */ void Material:: -output(ostream &out) const { +output(std::ostream &out) const { out << "Material " << get_name(); if (has_base_color()) { out << " c(" << get_base_color() << ")"; @@ -432,7 +432,7 @@ output(ostream &out) const { * */ void Material:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << "Material " << get_name() << "\n"; if (has_base_color()) { indent(out, indent_level + 2) << "base_color = " << get_ambient() << "\n"; diff --git a/panda/src/gobj/materialPool.cxx b/panda/src/gobj/materialPool.cxx index 58fec6dcbc..a2dd6c9064 100644 --- a/panda/src/gobj/materialPool.cxx +++ b/panda/src/gobj/materialPool.cxx @@ -22,7 +22,7 @@ MaterialPool *MaterialPool::_global_ptr = nullptr; * Lists the contents of the material pool to the indicated output stream. */ void MaterialPool:: -write(ostream &out) { +write(std::ostream &out) { get_global_ptr()->ns_list_contents(out); } @@ -100,7 +100,7 @@ ns_garbage_collect() { * The nonstatic implementation of list_contents(). */ void MaterialPool:: -ns_list_contents(ostream &out) const { +ns_list_contents(std::ostream &out) const { LightMutexHolder holder(_lock); out << _materials.size() << " materials:\n"; diff --git a/panda/src/gobj/matrixLens.cxx b/panda/src/gobj/matrixLens.cxx index 147870a954..db647516c7 100644 --- a/panda/src/gobj/matrixLens.cxx +++ b/panda/src/gobj/matrixLens.cxx @@ -41,7 +41,7 @@ is_linear() const { * */ void MatrixLens:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << get_type() << ":\n"; get_projection_mat().write(out, indent_level + 2); } diff --git a/panda/src/gobj/orthographicLens.cxx b/panda/src/gobj/orthographicLens.cxx index 86c8fe0ef5..131903935a 100644 --- a/panda/src/gobj/orthographicLens.cxx +++ b/panda/src/gobj/orthographicLens.cxx @@ -49,7 +49,7 @@ is_orthographic() const { * */ void OrthographicLens:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << get_type() << " film size = " << get_film_size() << "\n"; } diff --git a/panda/src/gobj/paramTexture.cxx b/panda/src/gobj/paramTexture.cxx index 7250cab5ec..892fe157c9 100644 --- a/panda/src/gobj/paramTexture.cxx +++ b/panda/src/gobj/paramTexture.cxx @@ -21,7 +21,7 @@ TypeHandle ParamTextureImage::_type_handle; * */ void ParamTextureSampler:: -output(ostream &out) const { +output(std::ostream &out) const { out << "texture "; if (_texture != nullptr) { @@ -96,7 +96,7 @@ fillin(DatagramIterator &scan, BamReader *manager) { * */ void ParamTextureImage:: -output(ostream &out) const { +output(std::ostream &out) const { out << "texture "; if (_texture != nullptr) { diff --git a/panda/src/gobj/preparedGraphicsObjects.cxx b/panda/src/gobj/preparedGraphicsObjects.cxx index a77a8837d7..4f6ecea1ed 100644 --- a/panda/src/gobj/preparedGraphicsObjects.cxx +++ b/panda/src/gobj/preparedGraphicsObjects.cxx @@ -162,7 +162,7 @@ set_graphics_memory_limit(size_t limit) { * vertex buffers are allocated in the LRU. */ void PreparedGraphicsObjects:: -show_graphics_memory_lru(ostream &out) const { +show_graphics_memory_lru(std::ostream &out) const { _graphics_memory_lru.write(out, 0); } @@ -171,7 +171,7 @@ show_graphics_memory_lru(ostream &out) const { * vertex buffers are allocated in the LRU. */ void PreparedGraphicsObjects:: -show_residency_trackers(ostream &out) const { +show_residency_trackers(std::ostream &out) const { out << "Textures:\n"; _texture_residency.write(out, 2); @@ -204,7 +204,7 @@ PT(PreparedGraphicsObjects::EnqueuedObject) PreparedGraphicsObjects:: enqueue_texture_future(Texture *tex) { ReMutexHolder holder(_lock); - pair result = + std::pair result = _enqueued_textures.insert(EnqueuedTextures::value_type(tex, nullptr)); if (result.first->second == nullptr) { result.first->second = new EnqueuedObject(this, tex); @@ -713,7 +713,7 @@ PT(PreparedGraphicsObjects::EnqueuedObject) PreparedGraphicsObjects:: enqueue_shader_future(Shader *shader) { ReMutexHolder holder(_lock); - pair result = + std::pair result = _enqueued_shaders.insert(EnqueuedShaders::value_type(shader, nullptr)); if (result.first->second == nullptr) { result.first->second = new EnqueuedObject(this, shader); @@ -1668,10 +1668,10 @@ end_frame(Thread *current_thread) { /** * Returns a new, unique name for a newly-constructed object. */ -string PreparedGraphicsObjects:: +std::string PreparedGraphicsObjects:: init_name() { ++_name_index; - ostringstream strm; + std::ostringstream strm; strm << "context" << _name_index; return strm.str(); } diff --git a/panda/src/gobj/samplerContext.cxx b/panda/src/gobj/samplerContext.cxx index aad143c2fc..5b8d9b3322 100644 --- a/panda/src/gobj/samplerContext.cxx +++ b/panda/src/gobj/samplerContext.cxx @@ -19,7 +19,7 @@ TypeHandle SamplerContext::_type_handle; * */ void SamplerContext:: -output(ostream &out) const { +output(std::ostream &out) const { SavedContext::output(out); } @@ -27,6 +27,6 @@ output(ostream &out) const { * */ void SamplerContext:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { SavedContext::write(out, indent_level); } diff --git a/panda/src/gobj/samplerState.cxx b/panda/src/gobj/samplerState.cxx index be8bd7b23d..9f1a5766bc 100644 --- a/panda/src/gobj/samplerState.cxx +++ b/panda/src/gobj/samplerState.cxx @@ -20,6 +20,8 @@ #include "samplerContext.h" #include "preparedGraphicsObjects.h" +using std::string; + TypeHandle SamplerState::_type_handle; SamplerState SamplerState::_default; @@ -283,7 +285,7 @@ compare_to(const SamplerState &other) const { * */ void SamplerState:: -output(ostream &out) const { +output(std::ostream &out) const { out << "sampler" << " wrap(u=" << _wrap_u << ", v=" << _wrap_v << ", w=" << _wrap_w @@ -298,7 +300,7 @@ output(ostream &out) const { * */ void SamplerState:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << "SamplerState\n"; indent(out, indent_level) << " wrap_u = " << _wrap_u << "\n"; indent(out, indent_level) << " wrap_v = " << _wrap_v << "\n"; diff --git a/panda/src/gobj/savedContext.cxx b/panda/src/gobj/savedContext.cxx index 2b93299121..92a1af46ca 100644 --- a/panda/src/gobj/savedContext.cxx +++ b/panda/src/gobj/savedContext.cxx @@ -20,7 +20,7 @@ TypeHandle SavedContext::_type_handle; * */ void SavedContext:: -output(ostream &out) const { +output(std::ostream &out) const { out << "SavedContext " << this; } @@ -28,6 +28,6 @@ output(ostream &out) const { * */ void SavedContext:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << *this << "\n"; } diff --git a/panda/src/gobj/shader.cxx b/panda/src/gobj/shader.cxx index 4f41cf57f1..b5e9e78489 100644 --- a/panda/src/gobj/shader.cxx +++ b/panda/src/gobj/shader.cxx @@ -27,6 +27,12 @@ #include #endif +using std::istream; +using std::move; +using std::ostream; +using std::ostringstream; +using std::string; + TypeHandle Shader::_type_handle; Shader::ShaderTable Shader::_load_table; Shader::ShaderTable Shader::_make_table; @@ -2455,7 +2461,7 @@ bool Shader:: do_read_source(string &into, const Filename &fn, BamCacheRecord *record) { if (_language == SL_GLSL && glsl_preprocess) { // Preprocess the GLSL file as we read it. - set open_files; + std::set open_files; ostringstream sstr; if (!r_preprocess_source(sstr, fn, Filename(), open_files, record)) { return false; @@ -2482,7 +2488,7 @@ do_read_source(string &into, const Filename &fn, BamCacheRecord *record) { if (record != nullptr) { record->add_dependent_file(vf); } - _last_modified = max(_last_modified, vf->get_timestamp()); + _last_modified = std::max(_last_modified, vf->get_timestamp()); _source_files.push_back(vf->get_filename()); } @@ -2504,7 +2510,7 @@ do_read_source(string &into, const Filename &fn, BamCacheRecord *record) { bool Shader:: r_preprocess_source(ostream &out, const Filename &fn, const Filename &source_dir, - set &once_files, + std::set &once_files, BamCacheRecord *record, int depth) { if (depth > glsl_include_recursion_limit) { @@ -2543,7 +2549,7 @@ r_preprocess_source(ostream &out, const Filename &fn, if (record != nullptr) { record->add_dependent_file(vf); } - _last_modified = max(_last_modified, vf->get_timestamp()); + _last_modified = std::max(_last_modified, vf->get_timestamp()); _source_files.push_back(full_fn); // We give each file an unique index. This is so that we can identify a @@ -3168,7 +3174,7 @@ load_compute(ShaderLanguage lang, const Filename &fn) { // It makes little sense to cache the shader before compilation, so we keep // the record for when we have the compiled the shader. - swap(shader->_record, record); + std::swap(shader->_record, record); shader->_cache_compiled_shader = BamCache::get_global_ptr()->get_cache_compiled_shaders(); shader->_fullpath = shader->_source_files[0]; return shader; @@ -3233,7 +3239,7 @@ make(string body, ShaderLanguage lang) { shader_cat.warning() << "Dumping shader: " << fn << "\n"; pofstream s; - s.open(fn.c_str(), ios::out | ios::trunc); + s.open(fn.c_str(), std::ios::out | std::ios::trunc); s << shader->get_text(); s.close(); } diff --git a/panda/src/gobj/shaderBuffer.cxx b/panda/src/gobj/shaderBuffer.cxx index da9dc37d4d..971787f0e6 100644 --- a/panda/src/gobj/shaderBuffer.cxx +++ b/panda/src/gobj/shaderBuffer.cxx @@ -28,7 +28,7 @@ ShaderBuffer:: * */ void ShaderBuffer:: -output(ostream &out) const { +output(std::ostream &out) const { out << "buffer " << get_name() << ", " << _data_size_bytes << "B, " << _usage_hint; } diff --git a/panda/src/gobj/simpleAllocator.cxx b/panda/src/gobj/simpleAllocator.cxx index 5790f35428..0cc087e2d7 100644 --- a/panda/src/gobj/simpleAllocator.cxx +++ b/panda/src/gobj/simpleAllocator.cxx @@ -32,7 +32,7 @@ SimpleAllocator:: * */ void SimpleAllocator:: -output(ostream &out) const { +output(std::ostream &out) const { MutexHolder holder(_lock); out << "SimpleAllocator, " << _total_size << " of " << _max_size << " allocated"; @@ -42,7 +42,7 @@ output(ostream &out) const { * */ void SimpleAllocator:: -write(ostream &out) const { +write(std::ostream &out) const { MutexHolder holder(_lock); out << "SimpleAllocator, " << _total_size << " of " << _max_size << " allocated"; @@ -168,7 +168,7 @@ changed_contiguous() { * */ void SimpleAllocatorBlock:: -output(ostream &out) const { +output(std::ostream &out) const { if (_allocator == nullptr) { out << "free block\n"; } else { diff --git a/panda/src/gobj/simpleLru.cxx b/panda/src/gobj/simpleLru.cxx index b24b48146c..dfdb9113da 100644 --- a/panda/src/gobj/simpleLru.cxx +++ b/panda/src/gobj/simpleLru.cxx @@ -14,6 +14,8 @@ #include "simpleLru.h" #include "indent.h" +using std::ostream; + // We define this as a reference to an allocated object, instead of as a // concrete object, so that it won't get destructed when the program exits. // (If it did, there would be an ordering issue between it and the various @@ -24,7 +26,7 @@ LightMutex &SimpleLru::_global_lock = *new LightMutex; * */ SimpleLru:: -SimpleLru(const string &name, size_t max_size) : +SimpleLru(const std::string &name, size_t max_size) : LinkedListNode(true), Namable(name) { diff --git a/panda/src/gobj/sliderTable.cxx b/panda/src/gobj/sliderTable.cxx index 169f023e3f..52ccdacc1c 100644 --- a/panda/src/gobj/sliderTable.cxx +++ b/panda/src/gobj/sliderTable.cxx @@ -124,7 +124,7 @@ add_slider(const VertexSlider *slider, const SparseArray &rows) { * */ void SliderTable:: -write(ostream &out) const { +write(std::ostream &out) const { for (size_t i = 0; i < _sliders.size(); ++i) { out << i << ". " << *_sliders[i]._slider << " " << _sliders[i]._rows << "\n"; diff --git a/panda/src/gobj/test_gobj.cxx b/panda/src/gobj/test_gobj.cxx index 74b408ec97..0bbe93e907 100644 --- a/panda/src/gobj/test_gobj.cxx +++ b/panda/src/gobj/test_gobj.cxx @@ -15,7 +15,7 @@ #include "perspectiveProjection.h" int main() { - nout << "running test_gobj" << endl; + nout << "running test_gobj" << std::endl; PT(GeomTri) triangle = new GeomTri; Frustumf frust; PT(PerspectiveProjection) proj = new PerspectiveProjection(frust); diff --git a/panda/src/gobj/texture.cxx b/panda/src/gobj/texture.cxx index 2479105093..1ebeec18db 100644 --- a/panda/src/gobj/texture.cxx +++ b/panda/src/gobj/texture.cxx @@ -49,6 +49,14 @@ #include +using std::endl; +using std::istream; +using std::max; +using std::min; +using std::ostream; +using std::string; +using std::swap; + ConfigVariableEnum texture_quality_level ("texture-quality-level", Texture::QL_normal, PRC_DESC("This specifies a global quality level for all textures. You " @@ -3960,7 +3968,7 @@ do_read_dds(CData *cdata, istream &in, const string &filename, bool header_only) default: gobj_cat.error() << filename << ": unsupported texture compression (FourCC: 0x" - << hex << header.pf.four_cc << dec << ").\n"; + << std::hex << header.pf.four_cc << std::dec << ").\n"; return false; } @@ -4432,8 +4440,8 @@ do_read_ktx(CData *cdata, istream &in, const string &filename, bool header_only) if (base_format != gl_base_format) { gobj_cat.error() << filename << " has internal format that is incompatible with base " - "format (0x" << hex << gl_base_format << ", expected 0x" - << base_format << dec << ")\n"; + "format (0x" << std::hex << gl_base_format << ", expected 0x" + << base_format << std::dec << ")\n"; return false; } @@ -4895,14 +4903,14 @@ do_read_ktx(CData *cdata, istream &in, const string &filename, bool header_only) } } - do_set_ram_mipmap_image(cdata, (int)n, move(image), + do_set_ram_mipmap_image(cdata, (int)n, std::move(image), row_size * do_get_expected_mipmap_y_size(cdata, (int)n)); } else { // Compressed image. We'll trust that the file has the right size. image = PTA_uchar::empty_array(image_size); ktx.extract_bytes(image.p(), image_size); - do_set_ram_mipmap_image(cdata, (int)n, move(image), image_size / depth); + do_set_ram_mipmap_image(cdata, (int)n, std::move(image), image_size / depth); } ktx.skip_bytes(3 - ((image_size + 3) & 3)); diff --git a/panda/src/gobj/textureCollection.cxx b/panda/src/gobj/textureCollection.cxx index 16c6a908f6..57f91a8ef8 100644 --- a/panda/src/gobj/textureCollection.cxx +++ b/panda/src/gobj/textureCollection.cxx @@ -181,7 +181,7 @@ reserve(size_t num) { * NULL if no texture has that name. */ Texture *TextureCollection:: -find_texture(const string &name) const { +find_texture(const std::string &name) const { int num_textures = get_num_textures(); for (int i = 0; i < num_textures; i++) { Texture *texture = get_texture(i); @@ -235,7 +235,7 @@ size() const { * indicated output stream. */ void TextureCollection:: -output(ostream &out) const { +output(std::ostream &out) const { if (get_num_textures() == 1) { out << "1 Texture"; } else { @@ -248,7 +248,7 @@ output(ostream &out) const { * indicated output stream. */ void TextureCollection:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { for (int i = 0; i < get_num_textures(); i++) { indent(out, indent_level) << *get_texture(i) << "\n"; } diff --git a/panda/src/gobj/textureCollection_ext.cxx b/panda/src/gobj/textureCollection_ext.cxx index 233249ee6f..127bba9ac5 100644 --- a/panda/src/gobj/textureCollection_ext.cxx +++ b/panda/src/gobj/textureCollection_ext.cxx @@ -44,9 +44,9 @@ __init__(PyObject *self, PyObject *sequence) { DTOOL_Call_ExtractThisPointerForType(item, &Dtool_Texture, (void **)&tex); if (tex == nullptr) { // Unable to add item--probably it wasn't of the appropriate type. - ostringstream stream; + std::ostringstream stream; stream << "Element " << i << " in sequence passed to TextureCollection constructor is not a Texture"; - string str = stream.str(); + std::string str = stream.str(); PyErr_SetString(PyExc_TypeError, str.c_str()); Py_DECREF(fast); return; diff --git a/panda/src/gobj/textureContext.cxx b/panda/src/gobj/textureContext.cxx index 32224a7bde..7a83a17a01 100644 --- a/panda/src/gobj/textureContext.cxx +++ b/panda/src/gobj/textureContext.cxx @@ -40,7 +40,7 @@ get_native_buffer_id() const { * */ void TextureContext:: -output(ostream &out) const { +output(std::ostream &out) const { out << *get_texture() << ", " << get_data_size_bytes(); } @@ -48,6 +48,6 @@ output(ostream &out) const { * */ void TextureContext:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { SavedContext::write(out, indent_level); } diff --git a/panda/src/gobj/texturePeeker.cxx b/panda/src/gobj/texturePeeker.cxx index b4e1be9224..5dc3368909 100644 --- a/panda/src/gobj/texturePeeker.cxx +++ b/panda/src/gobj/texturePeeker.cxx @@ -178,7 +178,7 @@ TexturePeeker(Texture *tex, Texture::CData *cdata) { default: // Not supported. gobj_cat.error() << "Unsupported texture peeker format: " - << Texture::format_format(_format) << endl; + << Texture::format_format(_format) << std::endl; _image.clear(); return; } diff --git a/panda/src/gobj/texturePool.cxx b/panda/src/gobj/texturePool.cxx index 1b39a24273..d62b68b377 100644 --- a/panda/src/gobj/texturePool.cxx +++ b/panda/src/gobj/texturePool.cxx @@ -28,6 +28,10 @@ #include "mutexHolder.h" #include "dcast.h" +using std::istream; +using std::ostream; +using std::string; + TexturePool *TexturePool::_global_ptr; /** @@ -128,7 +132,7 @@ write_texture_types(ostream &out, int indent_level) const { PT(Texture) tex = func(); string name = tex->get_type().get_name(); indent(out, indent_level) << name; - indent(out, max(30 - (int)name.length(), 0)) + indent(out, std::max(30 - (int)name.length(), 0)) << " ." << extension << "\n"; } } @@ -389,7 +393,7 @@ ns_load_texture(const Filename &orig_filename, // needs to be loaded from its source image(s). gobj_cat.info() << "Loading texture " << filename << " and alpha component " - << alpha_filename << endl; + << alpha_filename << std::endl; tex = ns_make_texture(filename.get_extension()); if (!tex->read(filename, alpha_filename, primary_file_num_channels, alpha_file_channel, 0, 0, false, read_mipmaps, nullptr, @@ -1245,11 +1249,11 @@ load_filters() { Filename dlname = Filename::dso_filename("lib" + name + ".so"); gobj_cat->info() - << "loading texture filter: " << dlname.to_os_specific() << endl; + << "loading texture filter: " << dlname.to_os_specific() << std::endl; void *tmp = load_dso(get_plugin_path().get_value(), dlname); if (tmp == nullptr) { gobj_cat.info() - << "Unable to load: " << load_dso_error() << endl; + << "Unable to load: " << load_dso_error() << std::endl; } } } diff --git a/panda/src/gobj/texturePoolFilter.cxx b/panda/src/gobj/texturePoolFilter.cxx index f0b98c877e..c63803860c 100644 --- a/panda/src/gobj/texturePoolFilter.cxx +++ b/panda/src/gobj/texturePoolFilter.cxx @@ -51,6 +51,6 @@ post_load(Texture *tex) { * */ void TexturePoolFilter:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type(); } diff --git a/panda/src/gobj/textureStage.cxx b/panda/src/gobj/textureStage.cxx index 120bb4feb3..4fecd20999 100644 --- a/panda/src/gobj/textureStage.cxx +++ b/panda/src/gobj/textureStage.cxx @@ -16,6 +16,8 @@ #include "bamReader.h" #include "bamWriter.h" +using std::ostream; + PT(TextureStage) TextureStage::_default_stage; UpdateSeq TextureStage::_sort_seq; @@ -25,7 +27,7 @@ TypeHandle TextureStage::_type_handle; * Initialize the texture stage at construction */ TextureStage:: -TextureStage(const string &name) : _used_by_auto_shader(false) { +TextureStage(const std::string &name) : _used_by_auto_shader(false) { _name = name; _sort = 0; _priority = 0; diff --git a/panda/src/gobj/textureStagePool.cxx b/panda/src/gobj/textureStagePool.cxx index f47addd52b..01e009ef7c 100644 --- a/panda/src/gobj/textureStagePool.cxx +++ b/panda/src/gobj/textureStagePool.cxx @@ -17,6 +17,10 @@ #include "configVariableEnum.h" #include "string_utils.h" +using std::istream; +using std::ostream; +using std::string; + TextureStagePool *TextureStagePool::_global_ptr = nullptr; diff --git a/panda/src/gobj/texture_ext.cxx b/panda/src/gobj/texture_ext.cxx index 3cd291843f..9af792be08 100644 --- a/panda/src/gobj/texture_ext.cxx +++ b/panda/src/gobj/texture_ext.cxx @@ -77,7 +77,7 @@ set_ram_image(PyObject *image, Texture::CompressionMode compression, PTA_uchar data = PTA_uchar::empty_array(view.len, Texture::get_class_type()); memcpy(data.p(), view.buf, view.len); - _this->set_ram_image(move(data), compression, page_size); + _this->set_ram_image(std::move(data), compression, page_size); PyBuffer_Release(&view); return; @@ -102,7 +102,7 @@ set_ram_image(PyObject *image, Texture::CompressionMode compression, PTA_uchar data = PTA_uchar::empty_array(buffer_len, Texture::get_class_type()); memcpy(data.p(), buffer, buffer_len); - _this->set_ram_image(move(data), compression, page_size); + _this->set_ram_image(std::move(data), compression, page_size); return; } #endif @@ -117,7 +117,7 @@ set_ram_image(PyObject *image, Texture::CompressionMode compression, * support compressed image data or sub-pages; use set_ram_image() for that. */ void Extension:: -set_ram_image_as(PyObject *image, const string &provided_format) { +set_ram_image_as(PyObject *image, const std::string &provided_format) { // Check if perhaps a PointerToArray object was passed in. if (DtoolInstance_Check(image)) { if (DtoolInstance_TYPE(image) == &Dtool_ConstPointerToArray_unsigned_char) { @@ -155,7 +155,7 @@ set_ram_image_as(PyObject *image, const string &provided_format) { PTA_uchar data = PTA_uchar::empty_array(view.len, Texture::get_class_type()); memcpy(data.p(), view.buf, view.len); - _this->set_ram_image_as(move(data), provided_format); + _this->set_ram_image_as(std::move(data), provided_format); PyBuffer_Release(&view); return; diff --git a/panda/src/gobj/transformBlend.cxx b/panda/src/gobj/transformBlend.cxx index 656a691a95..9ca70390e2 100644 --- a/panda/src/gobj/transformBlend.cxx +++ b/panda/src/gobj/transformBlend.cxx @@ -54,7 +54,7 @@ add_transform(const VertexTransform *transform, PN_stdfloat weight) { TransformEntry entry; entry._transform = transform; entry._weight = weight; - pair result = _entries.insert(entry); + std::pair result = _entries.insert(entry); if (!result.second) { // If the new value was not inserted, it was already there; increment // the existing weight factor. @@ -168,7 +168,7 @@ get_weight(const VertexTransform *transform) const { * */ void TransformBlend:: -output(ostream &out) const { +output(std::ostream &out) const { if (_entries.empty()) { out << "empty"; } else { @@ -186,7 +186,7 @@ output(ostream &out) const { * */ void TransformBlend:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { Thread *current_thread = Thread::get_current_thread(); Entries::const_iterator ei; for (ei = _entries.begin(); ei != _entries.end(); ++ei) { @@ -218,7 +218,7 @@ recompute_result(CData *cdata, Thread *current_thread) { UpdateSeq seq; Entries::const_iterator ei; for (ei = _entries.begin(); ei != _entries.end(); ++ei) { - seq = max(seq, (*ei)._transform->get_modified(current_thread)); + seq = std::max(seq, (*ei)._transform->get_modified(current_thread)); } if (cdata->_modified != seq) { diff --git a/panda/src/gobj/transformBlendTable.cxx b/panda/src/gobj/transformBlendTable.cxx index da76d38626..266da16c3b 100644 --- a/panda/src/gobj/transformBlendTable.cxx +++ b/panda/src/gobj/transformBlendTable.cxx @@ -107,7 +107,7 @@ add_blend(const TransformBlend &blend) { // latest. const TransformBlend &added_blend = _blends[new_position]; _blend_index[&added_blend] = new_position; - _max_simultaneous_transforms = max(_max_simultaneous_transforms, + _max_simultaneous_transforms = std::max(_max_simultaneous_transforms, (int)blend.get_num_transforms()); // We can't compute this one as we go, so set it to a special value to @@ -122,7 +122,7 @@ add_blend(const TransformBlend &blend) { * */ void TransformBlendTable:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { for (size_t i = 0; i < _blends.size(); ++i) { indent(out, indent_level) << i << ". " << _blends[i] << "\n"; @@ -158,7 +158,7 @@ rebuild_index() { for (size_t ti = 0; ti < blend.get_num_transforms(); ++ti) { transforms.insert(blend.get_transform(ti)); } - _max_simultaneous_transforms = max((size_t)_max_simultaneous_transforms, + _max_simultaneous_transforms = std::max((size_t)_max_simultaneous_transforms, blend.get_num_transforms()); } @@ -179,7 +179,7 @@ recompute_modified(TransformBlendTable::CData *cdata, Thread *current_thread) { UpdateSeq seq; Blends::const_iterator bi; for (bi = _blends.begin(); bi != _blends.end(); ++bi) { - seq = max(seq, (*bi).get_modified(current_thread)); + seq = std::max(seq, (*bi).get_modified(current_thread)); } cdata->_modified = seq; diff --git a/panda/src/gobj/transformTable.cxx b/panda/src/gobj/transformTable.cxx index df66f7a696..3ddadca33a 100644 --- a/panda/src/gobj/transformTable.cxx +++ b/panda/src/gobj/transformTable.cxx @@ -111,7 +111,7 @@ add_transform(const VertexTransform *transform) { * */ void TransformTable:: -write(ostream &out) const { +write(std::ostream &out) const { for (size_t i = 0; i < _transforms.size(); ++i) { out << i << ". " << *_transforms[i] << "\n"; } diff --git a/panda/src/gobj/userVertexSlider.cxx b/panda/src/gobj/userVertexSlider.cxx index d6363082a8..a868be2058 100644 --- a/panda/src/gobj/userVertexSlider.cxx +++ b/panda/src/gobj/userVertexSlider.cxx @@ -21,7 +21,7 @@ TypeHandle UserVertexSlider::_type_handle; * */ UserVertexSlider:: -UserVertexSlider(const string &name) : +UserVertexSlider(const std::string &name) : VertexSlider(InternalName::make(name)) { } diff --git a/panda/src/gobj/userVertexTransform.cxx b/panda/src/gobj/userVertexTransform.cxx index d83aeb4c8a..c27cb38d61 100644 --- a/panda/src/gobj/userVertexTransform.cxx +++ b/panda/src/gobj/userVertexTransform.cxx @@ -21,7 +21,7 @@ TypeHandle UserVertexTransform::_type_handle; * */ UserVertexTransform:: -UserVertexTransform(const string &name) : +UserVertexTransform(const std::string &name) : _name(name) { } @@ -39,7 +39,7 @@ get_matrix(LMatrix4 &matrix) const { * */ void UserVertexTransform:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type() << " " << get_name(); } diff --git a/panda/src/gobj/vertexBufferContext.cxx b/panda/src/gobj/vertexBufferContext.cxx index cde6ec023a..b0eab66a74 100644 --- a/panda/src/gobj/vertexBufferContext.cxx +++ b/panda/src/gobj/vertexBufferContext.cxx @@ -20,7 +20,7 @@ TypeHandle VertexBufferContext::_type_handle; * */ void VertexBufferContext:: -output(ostream &out) const { +output(std::ostream &out) const { out << *get_data() << ", " << get_data_size_bytes(); } @@ -28,6 +28,6 @@ output(ostream &out) const { * */ void VertexBufferContext:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { SavedContext::write(out, indent_level); } diff --git a/panda/src/gobj/vertexDataBuffer.cxx b/panda/src/gobj/vertexDataBuffer.cxx index a891811091..e1d3ad5c56 100644 --- a/panda/src/gobj/vertexDataBuffer.cxx +++ b/panda/src/gobj/vertexDataBuffer.cxx @@ -102,7 +102,7 @@ do_clean_realloc(size_t reserved_size) { _reserved_size = reserved_size; } - _size = min(_size, _reserved_size); + _size = std::min(_size, _reserved_size); } /** diff --git a/panda/src/gobj/vertexDataPage.cxx b/panda/src/gobj/vertexDataPage.cxx index e7adb80d33..74e58edb58 100644 --- a/panda/src/gobj/vertexDataPage.cxx +++ b/panda/src/gobj/vertexDataPage.cxx @@ -211,7 +211,7 @@ flush_threads() { * */ void VertexDataPage:: -output(ostream &out) const { +output(std::ostream &out) const { SimpleAllocator::output(out); } @@ -219,7 +219,7 @@ output(ostream &out) const { * */ void VertexDataPage:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { SimpleAllocator::write(out); } @@ -391,7 +391,7 @@ make_resident() { while (result != Z_STREAM_END) { unsigned char *start_out = (unsigned char *)z_source.next_out; nassertv(start_out < end_data); - z_source.avail_out = min((size_t)(end_data - start_out), (size_t)inflate_page_size); + z_source.avail_out = std::min((size_t)(end_data - start_out), (size_t)inflate_page_size); nassertv(z_source.avail_out != 0); result = inflate(&z_source, flush); if (result < 0 && result != Z_BUF_ERROR) { @@ -884,7 +884,7 @@ start_threads(int num_threads) { _threads.reserve(num_threads); for (int i = 0; i < num_threads; ++i) { - ostringstream name_strm; + std::ostringstream name_strm; name_strm << "VertexDataPage" << _threads.size(); PT(PageThread) thread = new PageThread(this, name_strm.str()); thread->start(TP_low, true); @@ -919,7 +919,7 @@ stop_threads() { * */ VertexDataPage::PageThread:: -PageThread(PageThreadManager *manager, const string &name) : +PageThread(PageThreadManager *manager, const std::string &name) : Thread(name, name), _manager(manager), _working_cvar(_tlock) diff --git a/panda/src/gobj/vertexDataSaveFile.cxx b/panda/src/gobj/vertexDataSaveFile.cxx index 97a77688a8..37839099dc 100644 --- a/panda/src/gobj/vertexDataSaveFile.cxx +++ b/panda/src/gobj/vertexDataSaveFile.cxx @@ -28,11 +28,14 @@ #include #endif +using std::dec; +using std::hex; + /** * */ VertexDataSaveFile:: -VertexDataSaveFile(const Filename &directory, const string &prefix, +VertexDataSaveFile(const Filename &directory, const std::string &prefix, size_t max_size) : SimpleAllocator(max_size, _lock) { @@ -50,12 +53,12 @@ VertexDataSaveFile(const Filename &directory, const string &prefix, int index = 0; while (true) { ++index; - ostringstream strm; + std::ostringstream strm; strm << prefix << "_" << index << ".dat"; - string basename = strm.str(); + std::string basename = strm.str(); _filename = Filename(dir, basename); - string os_specific = _filename.to_os_specific(); + std::string os_specific = _filename.to_os_specific(); if (gobj_cat.is_debug()) { gobj_cat.debug() @@ -201,7 +204,7 @@ write_data(const unsigned char *data, size_t size, bool compressed) { PT(VertexDataSaveBlock) block = (VertexDataSaveBlock *)SimpleAllocator::do_alloc(size); if (block != nullptr) { - _total_file_size = max(_total_file_size, block->get_start() + size); + _total_file_size = std::max(_total_file_size, block->get_start() + size); block->set_compressed(compressed); #ifdef _WIN32 diff --git a/panda/src/gobj/vertexSlider.cxx b/panda/src/gobj/vertexSlider.cxx index 86d841ad53..bc05232eb2 100644 --- a/panda/src/gobj/vertexSlider.cxx +++ b/panda/src/gobj/vertexSlider.cxx @@ -40,7 +40,7 @@ VertexSlider:: * */ void VertexSlider:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type() << " " << *get_name(); } @@ -48,7 +48,7 @@ output(ostream &out) const { * */ void VertexSlider:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << *this << " = " << get_slider() << "\n"; } diff --git a/panda/src/gobj/vertexTransform.cxx b/panda/src/gobj/vertexTransform.cxx index 35a60bd25a..972584b527 100644 --- a/panda/src/gobj/vertexTransform.cxx +++ b/panda/src/gobj/vertexTransform.cxx @@ -68,7 +68,7 @@ accumulate_matrix(LMatrix4 &accum, PN_stdfloat weight) const { * */ void VertexTransform:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type(); } @@ -76,7 +76,7 @@ output(ostream &out) const { * */ void VertexTransform:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << *this << ":\n"; LMatrix4 mat; diff --git a/panda/src/gobj/videoTexture.cxx b/panda/src/gobj/videoTexture.cxx index 0cde2d98f6..a3b5e2c72b 100644 --- a/panda/src/gobj/videoTexture.cxx +++ b/panda/src/gobj/videoTexture.cxx @@ -23,7 +23,7 @@ TypeHandle VideoTexture::_type_handle; * */ VideoTexture:: -VideoTexture(const string &name) : +VideoTexture(const std::string &name) : Texture(name) { // We don't want to try to compress each frame as it's loaded. @@ -104,8 +104,8 @@ set_video_size(int video_width, int video_height) { Texture::CDWriter cdata(Texture::_cycler, true); do_set_pad_size(cdata, - max(cdata->_x_size - _video_width, 0), - max(cdata->_y_size - _video_height, 0), + std::max(cdata->_x_size - _video_width, 0), + std::max(cdata->_y_size - _video_height, 0), 0); } @@ -181,7 +181,7 @@ do_can_reload(const Texture::CData *cdata) const { */ bool VideoTexture:: do_adjust_this_size(const Texture::CData *cdata_tex, - int &x_size, int &y_size, const string &name, + int &x_size, int &y_size, const std::string &name, bool for_padding) const { AutoTextureScale ats = do_get_auto_texture_scale(cdata_tex); if (ats != ATS_none) { diff --git a/panda/src/grutil/fisheyeMaker.cxx b/panda/src/grutil/fisheyeMaker.cxx index f245242aec..ad7a8a90ef 100644 --- a/panda/src/grutil/fisheyeMaker.cxx +++ b/panda/src/grutil/fisheyeMaker.cxx @@ -177,7 +177,7 @@ generate() { int piece_size = max_vertices_per_primitive / 2 - 1; int vi = 0; while (vi < ring_size) { - int piece_end = min(ring_size + 1, piece_size + 1 + vi); + int piece_end = std::min(ring_size + 1, piece_size + 1 + vi); for (int pi = vi; pi < piece_end; ++pi) { tristrips->add_vertex(last_ring_vertex + pi % last_ring_size); tristrips->add_vertex(ring_vertex + pi % ring_size); @@ -284,7 +284,7 @@ generate() { int piece_size = max_vertices_per_primitive / 2 - 1; int vi = 0; while (vi < ring_size) { - int piece_end = min(ring_size + 1, piece_size + 1 + vi); + int piece_end = std::min(ring_size + 1, piece_size + 1 + vi); for (int pi = vi; pi < piece_end; ++pi) { tristrips->add_vertex(last_ring_vertex + pi % last_ring_size); tristrips->add_vertex(ring_vertex + pi % ring_size); diff --git a/panda/src/grutil/frameRateMeter.cxx b/panda/src/grutil/frameRateMeter.cxx index 0b9fc9d1bb..f015e0ab55 100644 --- a/panda/src/grutil/frameRateMeter.cxx +++ b/panda/src/grutil/frameRateMeter.cxx @@ -31,7 +31,7 @@ TypeHandle FrameRateMeter::_type_handle; * */ FrameRateMeter:: -FrameRateMeter(const string &name) : +FrameRateMeter(const std::string &name) : TextNode(name), _last_aspect_ratio(-1) { diff --git a/panda/src/grutil/geoMipTerrain.cxx b/panda/src/grutil/geoMipTerrain.cxx index a627ac11f7..457e55d901 100644 --- a/panda/src/grutil/geoMipTerrain.cxx +++ b/panda/src/grutil/geoMipTerrain.cxx @@ -29,6 +29,9 @@ #include "collideMask.h" +using std::max; +using std::min; + static ConfigVariableBool geomipterrain_incorrect_normals ("geomipterrain-incorrect-normals", false, PRC_DESC("If true, uses the incorrect normal vector calculation that " @@ -256,7 +259,7 @@ generate_block(unsigned short mx, geom->add_primitive(prim); geom->set_bounds_type(BoundingVolume::BT_box); - ostringstream sname; + std::ostringstream sname; sname << "gmm" << mx << "x" << my; PT(GeomNode) node = new GeomNode(sname.str()); node->add_geom(geom); diff --git a/panda/src/grutil/lineSegs.cxx b/panda/src/grutil/lineSegs.cxx index 7e53416855..534c1f5700 100644 --- a/panda/src/grutil/lineSegs.cxx +++ b/panda/src/grutil/lineSegs.cxx @@ -29,7 +29,7 @@ * which will render the described path. */ LineSegs:: -LineSegs(const string &name) : Namable(name) { +LineSegs(const std::string &name) : Namable(name) { _color.set(1.0f, 1.0f, 1.0f, 1.0f); _thick = 1.0f; } diff --git a/panda/src/grutil/movieTexture.cxx b/panda/src/grutil/movieTexture.cxx index ab8cb390ef..280079948d 100644 --- a/panda/src/grutil/movieTexture.cxx +++ b/panda/src/grutil/movieTexture.cxx @@ -35,7 +35,7 @@ TypeHandle MovieTexture::_type_handle; * do_load_one. */ MovieTexture:: -MovieTexture(const string &name) : +MovieTexture(const std::string &name) : Texture(name) { } @@ -177,8 +177,8 @@ do_recalculate_image_properties(CData *cdata, Texture::CData *cdata_tex, const L cdata_tex->_orig_file_y_size = cdata->_video_height; do_set_pad_size(cdata_tex, - max(cdata_tex->_x_size - cdata_tex->_orig_file_x_size, 0), - max(cdata_tex->_y_size - cdata_tex->_orig_file_y_size, 0), + std::max(cdata_tex->_x_size - cdata_tex->_orig_file_x_size, 0), + std::max(cdata_tex->_y_size - cdata_tex->_orig_file_y_size, 0), 0); } @@ -188,7 +188,7 @@ do_recalculate_image_properties(CData *cdata, Texture::CData *cdata_tex, const L */ bool MovieTexture:: do_adjust_this_size(const Texture::CData *cdata_tex, - int &x_size, int &y_size, const string &name, + int &x_size, int &y_size, const std::string &name, bool for_padding) const { AutoTextureScale ats = do_get_auto_texture_scale(cdata_tex); if (ats != ATS_none) { @@ -285,7 +285,7 @@ do_load_one(Texture::CData *cdata_tex, */ bool MovieTexture:: do_load_one(Texture::CData *cdata_tex, - const PNMImage &pnmimage, const string &name, int z, int n, + const PNMImage &pnmimage, const std::string &name, int z, int n, const LoaderOptions &options) { grutil_cat.error() << "You cannot load a static image into a MovieTexture\n"; return false; @@ -534,7 +534,7 @@ play() { void MovieTexture:: set_time(double t) { CDWriter cdata(_cycler); - t = min(cdata->_video_length, max(0.0, t)); + t = std::min(cdata->_video_length, std::max(0.0, t)); if (cdata->_playing) { double now = ClockObject::get_global_clock()->get_frame_time(); cdata->_clock = t - (now * cdata->_play_rate); diff --git a/panda/src/grutil/multitexReducer.cxx b/panda/src/grutil/multitexReducer.cxx index 5d76ade23a..fdad25bb48 100644 --- a/panda/src/grutil/multitexReducer.cxx +++ b/panda/src/grutil/multitexReducer.cxx @@ -37,6 +37,9 @@ #include "geomVertexWriter.h" #include "geomVertexReader.h" +using std::max; +using std::min; + /** * */ @@ -236,7 +239,7 @@ flatten(GraphicsOutput *window) { window); static int multitex_id = 1; - ostringstream multitex_name_strm; + std::ostringstream multitex_name_strm; multitex_name_strm << "multitex" << multitex_id; multitex_id++; @@ -437,7 +440,7 @@ scan_geom_node(GeomNode *node, const RenderState *state, if (grutil_cat.is_debug()) { grutil_cat.debug() << "geom " << gi << " net_state =\n"; - geom_net_state->write(cerr, 2); + geom_net_state->write(std::cerr, 2); } // Get out the net TextureAttrib and TexMatrixAttrib from the state. diff --git a/panda/src/grutil/nodeVertexTransform.cxx b/panda/src/grutil/nodeVertexTransform.cxx index 5fb44d6cc1..7d4cb2deac 100644 --- a/panda/src/grutil/nodeVertexTransform.cxx +++ b/panda/src/grutil/nodeVertexTransform.cxx @@ -46,7 +46,7 @@ get_matrix(LMatrix4 &matrix) const { * */ void NodeVertexTransform:: -output(ostream &out) const { +output(std::ostream &out) const { if (_prev != nullptr) { _prev->output(out); out << " * "; diff --git a/panda/src/grutil/pfmVizzer.cxx b/panda/src/grutil/pfmVizzer.cxx index 4d1a65d416..f3d60787a8 100644 --- a/panda/src/grutil/pfmVizzer.cxx +++ b/panda/src/grutil/pfmVizzer.cxx @@ -23,6 +23,9 @@ #include "pnmImage.h" #include "config_grutil.h" +using std::max; +using std::min; + /** * The PfmVizzer constructor receives a reference to a PfmFile which it will * operate on. It does not keep ownership of this reference; it is your @@ -777,7 +780,7 @@ make_vis_mesh_geom(GeomNode *gnode, bool inverted) const { num_vertices = x_size * y_size; max_indices = (x_size - 1) * (y_size - 1) * 6; - ostringstream mesh_name; + std::ostringstream mesh_name; mesh_name << "mesh_" << xci << "_" << yci; PT(GeomVertexData) vdata = new GeomVertexData (mesh_name.str(), format, Geom::UH_static); diff --git a/panda/src/grutil/rigidBodyCombiner.cxx b/panda/src/grutil/rigidBodyCombiner.cxx index 44f2971aa5..fb2c3959ab 100644 --- a/panda/src/grutil/rigidBodyCombiner.cxx +++ b/panda/src/grutil/rigidBodyCombiner.cxx @@ -30,7 +30,7 @@ TypeHandle RigidBodyCombiner::_type_handle; * */ RigidBodyCombiner:: -RigidBodyCombiner(const string &name) : PandaNode(name) { +RigidBodyCombiner(const std::string &name) : PandaNode(name) { set_cull_callback(); _internal_root = new PandaNode(name); diff --git a/panda/src/grutil/sceneGraphAnalyzerMeter.cxx b/panda/src/grutil/sceneGraphAnalyzerMeter.cxx index 9881575f62..02d6ed3709 100644 --- a/panda/src/grutil/sceneGraphAnalyzerMeter.cxx +++ b/panda/src/grutil/sceneGraphAnalyzerMeter.cxx @@ -29,7 +29,7 @@ TypeHandle SceneGraphAnalyzerMeter::_type_handle; * */ SceneGraphAnalyzerMeter:: -SceneGraphAnalyzerMeter(const string &name, PandaNode *node) : TextNode(name) { +SceneGraphAnalyzerMeter(const std::string &name, PandaNode *node) : TextNode(name) { set_cull_callback(); Thread *current_thread = Thread::get_current_thread(); diff --git a/panda/src/grutil/shaderTerrainMesh.cxx b/panda/src/grutil/shaderTerrainMesh.cxx index d5ecdf21e2..44c8397279 100644 --- a/panda/src/grutil/shaderTerrainMesh.cxx +++ b/panda/src/grutil/shaderTerrainMesh.cxx @@ -34,6 +34,10 @@ #include "config_grutil.h" #include "typeHandle.h" +using std::endl; +using std::max; +using std::min; + ConfigVariableBool stm_use_hexagonal_layout ("stm-use-hexagonal-layout", false, PRC_DESC("Set this to true to use a hexagonal vertex layout. This approximates " @@ -542,7 +546,7 @@ void ShaderTerrainMesh::add_for_draw(CullTraverser *trav, CullTraverserData &dat state = state->set_attrib(current_shader_attrib, 10000); // Emit chunk - CullableObject *object = new CullableObject(_chunk_geom, move(state), move(modelview_transform)); + CullableObject *object = new CullableObject(_chunk_geom, std::move(state), std::move(modelview_transform)); trav->get_cull_handler()->record_object(object, trav); // After rendering, increment the view index diff --git a/panda/src/iphone/iphone_runappmf_src.mm b/panda/src/iphone/iphone_runappmf_src.mm index 40479f894f..56d97e8364 100644 --- a/panda/src/iphone/iphone_runappmf_src.mm +++ b/panda/src/iphone/iphone_runappmf_src.mm @@ -15,7 +15,6 @@ #include #include #include -using namespace std; #include "pnotify.h" diff --git a/panda/src/iphonedisplay/iPhoneGraphicsPipe.mm b/panda/src/iphonedisplay/iPhoneGraphicsPipe.mm index dba09cbcc9..82e92f4b70 100644 --- a/panda/src/iphonedisplay/iPhoneGraphicsPipe.mm +++ b/panda/src/iphonedisplay/iPhoneGraphicsPipe.mm @@ -51,7 +51,7 @@ IPhoneGraphicsPipe:: * choose between several possible GraphicsPipes available on a particular * platform, so the name should be meaningful and unique for a given platform. */ -string IPhoneGraphicsPipe:: +std::string IPhoneGraphicsPipe:: get_interface_name() const { return "OpenGL ES"; } diff --git a/panda/src/linmath/coordinateSystem.cxx b/panda/src/linmath/coordinateSystem.cxx index 6eb81077ca..b94b0ec4ff 100644 --- a/panda/src/linmath/coordinateSystem.cxx +++ b/panda/src/linmath/coordinateSystem.cxx @@ -21,6 +21,11 @@ #include +using std::istream; +using std::ostream; +using std::ostringstream; +using std::string; + static ConfigVariableEnum default_cs ("coordinate-system", CS_zup_right, PRC_DESC("The default coordinate system to use throughout Panda for " diff --git a/panda/src/linmath/lmatrix3_src.cxx b/panda/src/linmath/lmatrix3_src.cxx index e21160b2fd..e654b3accd 100644 --- a/panda/src/linmath/lmatrix3_src.cxx +++ b/panda/src/linmath/lmatrix3_src.cxx @@ -326,7 +326,7 @@ almost_equal(const FLOATNAME(LMatrix3) &other, FLOATTYPE threshold) const { * */ void FLOATNAME(LMatrix3):: -output(ostream &out) const { +output(std::ostream &out) const { out << "[ " << MAYBE_ZERO(_m(0, 0)) << " " << MAYBE_ZERO(_m(0, 1)) << " " @@ -346,7 +346,7 @@ output(ostream &out) const { * */ void FLOATNAME(LMatrix3):: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << MAYBE_ZERO(_m(0, 0)) << " " << MAYBE_ZERO(_m(0, 1)) << " " diff --git a/panda/src/linmath/lmatrix4_src.cxx b/panda/src/linmath/lmatrix4_src.cxx index 427841965f..0a1d5a6a0e 100644 --- a/panda/src/linmath/lmatrix4_src.cxx +++ b/panda/src/linmath/lmatrix4_src.cxx @@ -306,7 +306,7 @@ almost_equal(const FLOATNAME(LMatrix4) &other, FLOATTYPE threshold) const { * */ void FLOATNAME(LMatrix4):: -output(ostream &out) const { +output(std::ostream &out) const { out << "[ " << MAYBE_ZERO(_m(0, 0)) << " " << MAYBE_ZERO(_m(0, 1)) << " " @@ -334,7 +334,7 @@ output(ostream &out) const { * */ void FLOATNAME(LMatrix4):: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << MAYBE_ZERO(_m(0, 0)) << " " << MAYBE_ZERO(_m(0, 1)) << " " diff --git a/panda/src/linmath/test_math.cxx b/panda/src/linmath/test_math.cxx index 41d1d15431..5a92f433d2 100644 --- a/panda/src/linmath/test_math.cxx +++ b/panda/src/linmath/test_math.cxx @@ -19,6 +19,10 @@ #include "pnotify.h" #include +using std::cerr; +using std::cout; +using std::endl; + void test() { LMatrix4f x = LMatrix4f::ident_mat(); LMatrix4f y = LMatrix4f::ident_mat(); diff --git a/panda/src/mathutil/boundingBox.cxx b/panda/src/mathutil/boundingBox.cxx index e2ce9c6c6a..1f0a1b7758 100644 --- a/panda/src/mathutil/boundingBox.cxx +++ b/panda/src/mathutil/boundingBox.cxx @@ -22,6 +22,9 @@ #include #include +using std::max; +using std::min; + const int BoundingBox::plane_def[6][3] = { { 0, 4, 5 }, { 4, 6, 7 }, @@ -111,7 +114,7 @@ xform(const LMatrix4 &mat) { * */ void BoundingBox:: -output(ostream &out) const { +output(std::ostream &out) const { if (is_empty()) { out << "bbox, empty"; } else if (is_infinite()) { diff --git a/panda/src/mathutil/boundingHexahedron.cxx b/panda/src/mathutil/boundingHexahedron.cxx index b765f043b0..1e500cb64c 100644 --- a/panda/src/mathutil/boundingHexahedron.cxx +++ b/panda/src/mathutil/boundingHexahedron.cxx @@ -19,6 +19,9 @@ #include #include +using std::max; +using std::min; + TypeHandle BoundingHexahedron::_type_handle; /** @@ -151,7 +154,7 @@ xform(const LMatrix4 &mat) { * */ void BoundingHexahedron:: -output(ostream &out) const { +output(std::ostream &out) const { if (is_empty()) { out << "bhexahedron, empty"; } else if (is_infinite()) { @@ -165,7 +168,7 @@ output(ostream &out) const { * */ void BoundingHexahedron:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { if (is_empty()) { indent(out, indent_level) << "bhexahedron, empty\n"; } else if (is_infinite()) { diff --git a/panda/src/mathutil/boundingLine.cxx b/panda/src/mathutil/boundingLine.cxx index 38dd4704a5..93de2f6d5e 100644 --- a/panda/src/mathutil/boundingLine.cxx +++ b/panda/src/mathutil/boundingLine.cxx @@ -60,7 +60,7 @@ xform(const LMatrix4 &mat) { * */ void BoundingLine:: -output(ostream &out) const { +output(std::ostream &out) const { if (is_empty()) { out << "bline, empty"; } else if (is_infinite()) { diff --git a/panda/src/mathutil/boundingPlane.cxx b/panda/src/mathutil/boundingPlane.cxx index b0a36ab3e3..9690bb8dae 100644 --- a/panda/src/mathutil/boundingPlane.cxx +++ b/panda/src/mathutil/boundingPlane.cxx @@ -53,7 +53,7 @@ xform(const LMatrix4 &mat) { * */ void BoundingPlane:: -output(ostream &out) const { +output(std::ostream &out) const { if (is_empty()) { out << "bplane, empty"; } else if (is_infinite()) { diff --git a/panda/src/mathutil/boundingSphere.cxx b/panda/src/mathutil/boundingSphere.cxx index a0754b9b55..32e48adad9 100644 --- a/panda/src/mathutil/boundingSphere.cxx +++ b/panda/src/mathutil/boundingSphere.cxx @@ -22,6 +22,9 @@ #include +using std::max; +using std::min; + TypeHandle BoundingSphere::_type_handle; /** @@ -116,7 +119,7 @@ xform(const LMatrix4 &mat) { * */ void BoundingSphere:: -output(ostream &out) const { +output(std::ostream &out) const { if (is_empty()) { out << "bsphere, empty"; } else if (is_infinite()) { diff --git a/panda/src/mathutil/boundingVolume.cxx b/panda/src/mathutil/boundingVolume.cxx index d81f905e25..a806dc819b 100644 --- a/panda/src/mathutil/boundingVolume.cxx +++ b/panda/src/mathutil/boundingVolume.cxx @@ -24,6 +24,10 @@ #include "indent.h" +using std::istream; +using std::ostream; +using std::string; + TypeHandle BoundingVolume::_type_handle; diff --git a/panda/src/mathutil/intersectionBoundingVolume.cxx b/panda/src/mathutil/intersectionBoundingVolume.cxx index a8af2d2b97..334cb428fe 100644 --- a/panda/src/mathutil/intersectionBoundingVolume.cxx +++ b/panda/src/mathutil/intersectionBoundingVolume.cxx @@ -74,7 +74,7 @@ xform(const LMatrix4 &mat) { * */ void IntersectionBoundingVolume:: -output(ostream &out) const { +output(std::ostream &out) const { if (is_empty()) { out << "intersection, empty"; } else if (is_infinite()) { @@ -94,7 +94,7 @@ output(ostream &out) const { * */ void IntersectionBoundingVolume:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { if (is_empty()) { indent(out, indent_level) << "intersection, empty\n"; } else if (is_infinite()) { diff --git a/panda/src/mathutil/omniBoundingVolume.cxx b/panda/src/mathutil/omniBoundingVolume.cxx index 65e556b767..687374c1be 100644 --- a/panda/src/mathutil/omniBoundingVolume.cxx +++ b/panda/src/mathutil/omniBoundingVolume.cxx @@ -46,7 +46,7 @@ xform(const LMatrix4 &) { * */ void OmniBoundingVolume:: -output(ostream &out) const { +output(std::ostream &out) const { out << "omni"; } diff --git a/panda/src/mathutil/parabola_src.cxx b/panda/src/mathutil/parabola_src.cxx index a695a89c31..437ab012e5 100644 --- a/panda/src/mathutil/parabola_src.cxx +++ b/panda/src/mathutil/parabola_src.cxx @@ -27,7 +27,7 @@ xform(const FLOATNAME(LMatrix4) &mat) { * */ void FLOATNAME(LParabola):: -output(ostream &out) const { +output(std::ostream &out) const { out << "LParabola(" << _a << ", " << _b << ", " << _c << ")"; } @@ -35,7 +35,7 @@ output(ostream &out) const { * */ void FLOATNAME(LParabola):: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << *this << "\n"; } diff --git a/panda/src/mathutil/plane_src.cxx b/panda/src/mathutil/plane_src.cxx index 3a3baff375..7ba18701c6 100644 --- a/panda/src/mathutil/plane_src.cxx +++ b/panda/src/mathutil/plane_src.cxx @@ -145,7 +145,7 @@ intersects_parabola(FLOATTYPE &t1, FLOATTYPE &t2, * */ void FLOATNAME(LPlane):: -output(ostream &out) const { +output(std::ostream &out) const { out << "LPlane("; FLOATNAME(LVecBase4)::output(out); out << ")"; @@ -155,6 +155,6 @@ output(ostream &out) const { * */ void FLOATNAME(LPlane):: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << *this << "\n"; } diff --git a/panda/src/mathutil/test_tri.cxx b/panda/src/mathutil/test_tri.cxx index 57852b3773..e09b86fc21 100644 --- a/panda/src/mathutil/test_tri.cxx +++ b/panda/src/mathutil/test_tri.cxx @@ -42,7 +42,7 @@ int main(int argc, char *argv[]) { t.triangulate(); for (int i = 0; i < t.get_num_triangles(); ++i) { - cerr << "tri: " << t.get_triangle_v0(i) << " " + std::cerr << "tri: " << t.get_triangle_v0(i) << " " << t.get_triangle_v1(i) << " " << t.get_triangle_v2(i) << "\n"; } diff --git a/panda/src/mathutil/unionBoundingVolume.cxx b/panda/src/mathutil/unionBoundingVolume.cxx index ed575b518b..2c4d7c41a9 100644 --- a/panda/src/mathutil/unionBoundingVolume.cxx +++ b/panda/src/mathutil/unionBoundingVolume.cxx @@ -74,7 +74,7 @@ xform(const LMatrix4 &mat) { * */ void UnionBoundingVolume:: -output(ostream &out) const { +output(std::ostream &out) const { if (is_empty()) { out << "union, empty"; } else if (is_infinite()) { @@ -94,7 +94,7 @@ output(ostream &out) const { * */ void UnionBoundingVolume:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { if (is_empty()) { indent(out, indent_level) << "union, empty\n"; } else if (is_infinite()) { diff --git a/panda/src/movies/flacAudio.cxx b/panda/src/movies/flacAudio.cxx index b7c205b25b..07f41ca350 100644 --- a/panda/src/movies/flacAudio.cxx +++ b/panda/src/movies/flacAudio.cxx @@ -41,7 +41,7 @@ FlacAudio:: PT(MovieAudioCursor) FlacAudio:: open() { VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr(); - istream *stream = vfs->open_read_file(_filename, true); + std::istream *stream = vfs->open_read_file(_filename, true); if (stream == nullptr) { return nullptr; diff --git a/panda/src/movies/flacAudioCursor.cxx b/panda/src/movies/flacAudioCursor.cxx index e30fbfba8f..19eb71cbc9 100644 --- a/panda/src/movies/flacAudioCursor.cxx +++ b/panda/src/movies/flacAudioCursor.cxx @@ -25,7 +25,7 @@ extern "C" { * Callback passed to dr_flac to implement file I/O via the VirtualFileSystem. */ static size_t cb_read_proc(void *user, void *buffer, size_t size) { - istream *stream = (istream *)user; + std::istream *stream = (std::istream *)user; nassertr(stream != nullptr, false); stream->read((char *)buffer, size); @@ -42,10 +42,10 @@ static size_t cb_read_proc(void *user, void *buffer, size_t size) { * Callback passed to dr_flac to implement file I/O via the VirtualFileSystem. */ static bool cb_seek_proc(void *user, int offset) { - istream *stream = (istream *)user; + std::istream *stream = (std::istream *)user; nassertr(stream != nullptr, false); - stream->seekg(offset, ios::cur); + stream->seekg(offset, std::ios::cur); return !stream->fail(); } @@ -56,7 +56,7 @@ TypeHandle FlacAudioCursor::_type_handle; * pointer positioned at the start of the data. */ FlacAudioCursor:: -FlacAudioCursor(FlacAudio *src, istream *stream) : +FlacAudioCursor(FlacAudio *src, std::istream *stream) : MovieAudioCursor(src), _is_valid(false), _drflac(nullptr) @@ -99,7 +99,7 @@ FlacAudioCursor:: */ void FlacAudioCursor:: seek(double t) { - t = max(t, 0.0); + t = std::max(t, 0.0); uint64_t sample = t * _drflac->sampleRate; diff --git a/panda/src/movies/microphoneAudioDS.cxx b/panda/src/movies/microphoneAudioDS.cxx index cea9c65f60..1ce78b0209 100644 --- a/panda/src/movies/microphoneAudioDS.cxx +++ b/panda/src/movies/microphoneAudioDS.cxx @@ -149,7 +149,7 @@ find_all_microphones_ds() { stat = waveInOpen(nullptr, i, &format, 0, 0, WAVE_FORMAT_QUERY); if (stat == MMSYSERR_NOERROR) { PT(MicrophoneAudioDS) p = new MicrophoneAudioDS(); - ostringstream name; + std::ostringstream name; name << "WaveIn: " << caps.szPname << " Chan:" << chan << " HZ:" << freq; p->set_name(name.str()); p->_device_id = i; diff --git a/panda/src/movies/movieAudio.cxx b/panda/src/movies/movieAudio.cxx index 0dee90e805..6843984ac3 100644 --- a/panda/src/movies/movieAudio.cxx +++ b/panda/src/movies/movieAudio.cxx @@ -24,7 +24,7 @@ TypeHandle MovieAudio::_type_handle; * construct a subclass of this class. */ MovieAudio:: -MovieAudio(const string &name) : +MovieAudio(const std::string &name) : Namable(name) { } diff --git a/panda/src/movies/movieAudioCursor.cxx b/panda/src/movies/movieAudioCursor.cxx index f386401103..33acc0e10c 100644 --- a/panda/src/movies/movieAudioCursor.cxx +++ b/panda/src/movies/movieAudioCursor.cxx @@ -92,9 +92,9 @@ read_samples(int n, Datagram *dg) { * This is not particularly efficient, but it may be a convenient way to * manipulate samples in python. */ -string MovieAudioCursor:: +std::string MovieAudioCursor:: read_samples(int n) { - ostringstream result; + std::ostringstream result; int16_t tmp[4096]; while (n > 0) { int blocksize = (4096 / _audio_channels); diff --git a/panda/src/movies/movieTypeRegistry.cxx b/panda/src/movies/movieTypeRegistry.cxx index 024cf53634..012deff1cd 100644 --- a/panda/src/movies/movieTypeRegistry.cxx +++ b/panda/src/movies/movieTypeRegistry.cxx @@ -17,6 +17,9 @@ #include "config_putil.h" #include "load_dso.h" +using std::endl; +using std::string; + MovieTypeRegistry *MovieTypeRegistry::_global_ptr = nullptr; /** diff --git a/panda/src/movies/movieVideo.cxx b/panda/src/movies/movieVideo.cxx index cdeb797213..57b755a453 100644 --- a/panda/src/movies/movieVideo.cxx +++ b/panda/src/movies/movieVideo.cxx @@ -26,7 +26,7 @@ TypeHandle MovieVideo::_type_handle; * need to construct a subclass of this class. */ MovieVideo:: -MovieVideo(const string &name) : +MovieVideo(const std::string &name) : Namable(name) { } diff --git a/panda/src/movies/opusAudio.cxx b/panda/src/movies/opusAudio.cxx index 024560156a..54be404cd2 100644 --- a/panda/src/movies/opusAudio.cxx +++ b/panda/src/movies/opusAudio.cxx @@ -43,7 +43,7 @@ OpusAudio:: PT(MovieAudioCursor) OpusAudio:: open() { VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr(); - istream *stream = vfs->open_read_file(_filename, true); + std::istream *stream = vfs->open_read_file(_filename, true); if (stream == nullptr) { return nullptr; diff --git a/panda/src/movies/opusAudioCursor.cxx b/panda/src/movies/opusAudioCursor.cxx index 698648c5cb..2b1591e971 100644 --- a/panda/src/movies/opusAudioCursor.cxx +++ b/panda/src/movies/opusAudioCursor.cxx @@ -18,6 +18,8 @@ #include +using std::istream; + /** * Callbacks passed to libopusfile to implement file I/O via the * VirtualFileSystem. @@ -46,15 +48,15 @@ int cb_seek(void *stream, opus_int64 offset, int whence) { switch (whence) { case SEEK_SET: - in->seekg(offset, ios::beg); + in->seekg(offset, std::ios::beg); break; case SEEK_CUR: - in->seekg(offset, ios::cur); + in->seekg(offset, std::ios::cur); break; case SEEK_END: - in->seekg(offset, ios::end); + in->seekg(offset, std::ios::end); break; default: @@ -165,7 +167,7 @@ seek(double t) { return; } - t = max(t, 0.0); + t = std::max(t, 0.0); // Use op_time_seek_lap if cross-lapping is enabled. int error = op_pcm_seek(_op, (ogg_int64_t)(t * 48000.0)); diff --git a/panda/src/movies/userDataAudio.cxx b/panda/src/movies/userDataAudio.cxx index 81865e3b8b..f02726d10b 100644 --- a/panda/src/movies/userDataAudio.cxx +++ b/panda/src/movies/userDataAudio.cxx @@ -107,7 +107,7 @@ append(DatagramIterator *src, int n) { * but it may be convenient to deal with samples in python. */ void UserDataAudio:: -append(const string &str) { +append(const std::string &str) { nassertv(!_aborted); int samples = str.size() / (2 * _desired_channels); int words = samples * _desired_channels; diff --git a/panda/src/movies/vorbisAudio.cxx b/panda/src/movies/vorbisAudio.cxx index b3e32c84f4..db4c70b000 100644 --- a/panda/src/movies/vorbisAudio.cxx +++ b/panda/src/movies/vorbisAudio.cxx @@ -43,7 +43,7 @@ VorbisAudio:: PT(MovieAudioCursor) VorbisAudio:: open() { VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr(); - istream *stream = vfs->open_read_file(_filename, true); + std::istream *stream = vfs->open_read_file(_filename, true); if (stream == nullptr) { return nullptr; diff --git a/panda/src/movies/vorbisAudioCursor.cxx b/panda/src/movies/vorbisAudioCursor.cxx index 6f6002158f..d4478c9f07 100644 --- a/panda/src/movies/vorbisAudioCursor.cxx +++ b/panda/src/movies/vorbisAudioCursor.cxx @@ -16,6 +16,8 @@ #ifdef HAVE_VORBIS +using std::istream; + TypeHandle VorbisAudioCursor::_type_handle; /** @@ -82,7 +84,7 @@ seek(double t) { return; } - t = max(t, 0.0); + t = std::max(t, 0.0); // Use ov_time_seek_lap if cross-lapping is enabled. if (vorbis_seek_lap) { @@ -189,15 +191,15 @@ cb_seek_func(void *datasource, ogg_int64_t offset, int whence) { switch (whence) { case SEEK_SET: - stream->seekg(offset, ios::beg); + stream->seekg(offset, std::ios::beg); break; case SEEK_CUR: - stream->seekg(offset, ios::cur); + stream->seekg(offset, std::ios::cur); break; case SEEK_END: - stream->seekg(offset, ios::end); + stream->seekg(offset, std::ios::end); break; default: diff --git a/panda/src/movies/wavAudio.cxx b/panda/src/movies/wavAudio.cxx index 685a0a7d68..854d2aef5c 100644 --- a/panda/src/movies/wavAudio.cxx +++ b/panda/src/movies/wavAudio.cxx @@ -41,7 +41,7 @@ WavAudio:: PT(MovieAudioCursor) WavAudio:: open() { VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr(); - istream *stream = vfs->open_read_file(_filename, true); + std::istream *stream = vfs->open_read_file(_filename, true); if (stream == nullptr) { return nullptr; diff --git a/panda/src/movies/wavAudioCursor.cxx b/panda/src/movies/wavAudioCursor.cxx index 5f6cf05047..381ce2d81b 100644 --- a/panda/src/movies/wavAudioCursor.cxx +++ b/panda/src/movies/wavAudioCursor.cxx @@ -94,7 +94,7 @@ TypeHandle WavAudioCursor::_type_handle; * pointer positioned at the start of the data. */ WavAudioCursor:: -WavAudioCursor(WavAudio *src, istream *stream) : +WavAudioCursor(WavAudio *src, std::istream *stream) : MovieAudioCursor(src), _is_valid(false), _stream(stream), @@ -291,8 +291,8 @@ WavAudioCursor:: */ void WavAudioCursor:: seek(double t) { - t = max(t, 0.0); - streampos pos = _data_start + (streampos) min((size_t) (t * _byte_rate), _data_size); + t = std::max(t, 0.0); + std::streampos pos = _data_start + (std::streampos) std::min((size_t) (t * _byte_rate), _data_size); if (_can_seek_fast) { _stream->seekg(pos); @@ -303,7 +303,7 @@ seek(double t) { } if (!_can_seek_fast) { - streampos current = _stream->tellg(); + std::streampos current = _stream->tellg(); if (pos > current) { // It is ahead of our current position. Skip ahead. @@ -327,7 +327,7 @@ seek(double t) { void WavAudioCursor:: read_samples(int n, int16_t *data) { int desired = n * _audio_channels; - int read_samples = min(desired, ((int) (_data_size - _data_pos)) / _bytes_per_sample); + int read_samples = std::min(desired, ((int) (_data_size - _data_pos)) / _bytes_per_sample); if (read_samples <= 0) { return; diff --git a/panda/src/net/config_net.cxx b/panda/src/net/config_net.cxx index 9fcbdcbe91..80af80147a 100644 --- a/panda/src/net/config_net.cxx +++ b/panda/src/net/config_net.cxx @@ -119,9 +119,9 @@ get_net_max_block() { // This function is used in the ReaderThread and WriterThread constructors to // make a simple name for each thread. -string -make_thread_name(const string &thread_name, int thread_index) { - ostringstream stream; +std::string +make_thread_name(const std::string &thread_name, int thread_index) { + std::ostringstream stream; stream << thread_name << "_" << thread_index; return stream.str(); } diff --git a/panda/src/net/connection.cxx b/panda/src/net/connection.cxx index 1e96a758de..aecfc111ac 100644 --- a/panda/src/net/connection.cxx +++ b/panda/src/net/connection.cxx @@ -303,7 +303,7 @@ send_datagram(const NetDatagram &datagram, int tcp_header_size) { LightReMutexHolder holder(_write_mutex); DatagramUDPHeader header(datagram); - string data; + std::string data; data += header.get_header(); data += datagram.get_message(); @@ -374,7 +374,7 @@ send_raw_datagram(const NetDatagram &datagram) { Socket_UDP *udp; DCAST_INTO_R(udp, _socket, false); - string data = datagram.get_message(); + std::string data = datagram.get_message(); LightReMutexHolder holder(_write_mutex); Socket_Address addr = datagram.get_address().get_addr(); @@ -430,7 +430,7 @@ do_flush() { Socket_TCP *tcp; DCAST_INTO_R(tcp, _socket, false); - string sending_data; + std::string sending_data; _queued_data.swap(sending_data); _queued_count = 0; @@ -438,7 +438,7 @@ do_flush() { #if defined(HAVE_THREADS) && defined(SIMPLE_THREADS) int max_send = net_max_write_per_epoch; - int data_sent = tcp->SendData(sending_data.data(), min((size_t)max_send, sending_data.size())); + int data_sent = tcp->SendData(sending_data.data(), std::min((size_t)max_send, sending_data.size())); bool okflag = (data_sent == (int)sending_data.size()); if (!okflag) { int total_sent = 0; @@ -453,7 +453,7 @@ do_flush() { } else { Thread::consider_yield(); } - data_sent = tcp->SendData(sending_data.data() + total_sent, min((size_t)max_send, sending_data.size() - total_sent)); + data_sent = tcp->SendData(sending_data.data() + total_sent, std::min((size_t)max_send, sending_data.size() - total_sent)); if (data_sent > 0) { total_sent += data_sent; } diff --git a/panda/src/net/connectionListener.cxx b/panda/src/net/connectionListener.cxx index a48791b24d..2ab8b33ef7 100644 --- a/panda/src/net/connectionListener.cxx +++ b/panda/src/net/connectionListener.cxx @@ -19,8 +19,8 @@ #include "config_net.h" #include "socket_tcp_listen.h" -static string -listener_thread_name(const string &thread_name) { +static std::string +listener_thread_name(const std::string &thread_name) { if (!thread_name.empty()) { return thread_name; } @@ -32,7 +32,7 @@ listener_thread_name(const string &thread_name) { */ ConnectionListener:: ConnectionListener(ConnectionManager *manager, int num_threads, - const string &thread_name) : + const std::string &thread_name) : ConnectionReader(manager, num_threads, listener_thread_name(thread_name)) { } diff --git a/panda/src/net/connectionManager.cxx b/panda/src/net/connectionManager.cxx index 0d7da68000..f125356f50 100644 --- a/panda/src/net/connectionManager.cxx +++ b/panda/src/net/connectionManager.cxx @@ -33,6 +33,9 @@ #include #endif +using std::stringstream; +using std::string; + /** * */ @@ -412,7 +415,7 @@ wait_for_readers(double timeout) { double wait_timeout = get_net_max_block(); if (!block_forever) { - wait_timeout = min(wait_timeout, stop - now); + wait_timeout = std::min(wait_timeout, stop - now); } uint32_t wait_timeout_ms = (uint32_t)(wait_timeout * 1000.0); @@ -489,7 +492,7 @@ scan_interfaces() { // p->AdapterName appears to be a GUID. Not sure if this is actually // useful to anyone; we'll store the "friendly name" instead. TextEncoder encoder; - encoder.set_wtext(wstring(p->FriendlyName)); + encoder.set_wtext(std::wstring(p->FriendlyName)); string friendly_name = encoder.get_text(); Interface iface; @@ -716,12 +719,12 @@ remove_writer(ConnectionWriter *writer) { */ string ConnectionManager:: format_mac_address(const unsigned char *data, size_t data_size) { - stringstream strm; + std::stringstream strm; for (size_t di = 0; di < data_size; ++di) { if (di != 0) { strm << "-"; } - strm << hex << setw(2) << setfill('0') << (unsigned int)data[di]; + strm << std::hex << std::setw(2) << std::setfill('0') << (unsigned int)data[di]; } return strm.str(); @@ -731,7 +734,7 @@ format_mac_address(const unsigned char *data, size_t data_size) { * */ void ConnectionManager::Interface:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_name() << " ["; if (has_ip()) { out << " " << get_ip().get_ip_string(); diff --git a/panda/src/net/connectionReader.cxx b/panda/src/net/connectionReader.cxx index 4f9a31dca5..9fbab3e1dc 100644 --- a/panda/src/net/connectionReader.cxx +++ b/panda/src/net/connectionReader.cxx @@ -27,6 +27,8 @@ #include "atomicAdjust.h" #include "config_downloader.h" +using std::min; + static const int read_buffer_size = maximum_udp_datagram + datagram_udp_header_size; /** @@ -60,7 +62,7 @@ get_socket() const { * */ ConnectionReader::ReaderThread:: -ReaderThread(ConnectionReader *reader, const string &thread_name, +ReaderThread(ConnectionReader *reader, const std::string &thread_name, int thread_index) : Thread(make_thread_name(thread_name, thread_index), make_thread_name(thread_name, thread_index)), @@ -85,7 +87,7 @@ thread_main() { */ ConnectionReader:: ConnectionReader(ConnectionManager *manager, int num_threads, - const string &thread_name) : + const std::string &thread_name) : _manager(manager) { if (!Thread::is_threading_supported()) { @@ -111,7 +113,7 @@ ConnectionReader(ConnectionManager *manager, int num_threads, _currently_polling_thread = -1; - string reader_thread_name = thread_name; + std::string reader_thread_name = thread_name; if (thread_name.empty()) { reader_thread_name = "ReaderThread"; } diff --git a/panda/src/net/connectionWriter.cxx b/panda/src/net/connectionWriter.cxx index 554f8118c1..47cde6c35d 100644 --- a/panda/src/net/connectionWriter.cxx +++ b/panda/src/net/connectionWriter.cxx @@ -24,7 +24,7 @@ * */ ConnectionWriter::WriterThread:: -WriterThread(ConnectionWriter *writer, const string &thread_name, +WriterThread(ConnectionWriter *writer, const std::string &thread_name, int thread_index) : Thread(make_thread_name(thread_name, thread_index), make_thread_name(thread_name, thread_index)), @@ -50,7 +50,7 @@ thread_main() { */ ConnectionWriter:: ConnectionWriter(ConnectionManager *manager, int num_threads, - const string &thread_name) : + const std::string &thread_name) : _manager(manager) { if (!Thread::is_threading_supported()) { @@ -70,7 +70,7 @@ ConnectionWriter(ConnectionManager *manager, int num_threads, _immediate = (num_threads <= 0); _shutdown = false; - string writer_thread_name = thread_name; + std::string writer_thread_name = thread_name; if (thread_name.empty()) { writer_thread_name = "WriterThread"; } diff --git a/panda/src/net/datagramTCPHeader.cxx b/panda/src/net/datagramTCPHeader.cxx index bd013f0c33..44db216b3d 100644 --- a/panda/src/net/datagramTCPHeader.cxx +++ b/panda/src/net/datagramTCPHeader.cxx @@ -107,7 +107,7 @@ verify_datagram(const NetDatagram &datagram, int header_size) const { // We write the hex dump into a ostringstream first, to guarantee an // atomic write to the output stream in case we're threaded. - ostringstream hex; + std::ostringstream hex; datagram.dump_hex(hex); hex << "\n"; net_cat.debug() << hex.str(); diff --git a/panda/src/net/datagramUDPHeader.cxx b/panda/src/net/datagramUDPHeader.cxx index 2191c0241a..7c58205e8d 100644 --- a/panda/src/net/datagramUDPHeader.cxx +++ b/panda/src/net/datagramUDPHeader.cxx @@ -73,7 +73,7 @@ verify_datagram(const NetDatagram &datagram) const { // We write the hex dump into a ostringstream first, to guarantee an // atomic write to the output stream in case we're threaded. - ostringstream hex; + std::ostringstream hex; datagram.dump_hex(hex); hex << "\n"; net_cat.debug(false) << hex.str(); diff --git a/panda/src/net/datagram_ui.cxx b/panda/src/net/datagram_ui.cxx index fa9879bf86..d5f0bdea1b 100644 --- a/panda/src/net/datagram_ui.cxx +++ b/panda/src/net/datagram_ui.cxx @@ -19,6 +19,9 @@ #include #include +using std::istream; +using std::ostream; + enum DatagramElement { DE_int32, DE_float64, diff --git a/panda/src/net/fake_http_server.cxx b/panda/src/net/fake_http_server.cxx index 718b6db824..bc29e9806a 100644 --- a/panda/src/net/fake_http_server.cxx +++ b/panda/src/net/fake_http_server.cxx @@ -24,6 +24,8 @@ #include +using std::string; + QueuedConnectionManager cm; QueuedConnectionReader reader(&cm, 10); ConnectionWriter writer(&cm, 10); @@ -65,7 +67,7 @@ receive_data(const Datagram &data) { void ClientState:: receive_line(string line) { - cerr << "received: " << line << "\n"; + std::cerr << "received: " << line << "\n"; // trim trailing whitespace. size_t size = line.size(); while (size > 0 && isspace(line[size - 1])) { diff --git a/panda/src/net/netAddress.cxx b/panda/src/net/netAddress.cxx index 0f0404dc45..9d49623252 100644 --- a/panda/src/net/netAddress.cxx +++ b/panda/src/net/netAddress.cxx @@ -63,7 +63,7 @@ set_broadcast(int port) { * Returns true if the hostname is known, false otherwise. */ bool NetAddress:: -set_host(const string &hostname, int port) { +set_host(const std::string &hostname, int port) { return _addr.set_host(hostname, port); } @@ -102,7 +102,7 @@ is_any() const { /** * Returns the IP address to which this address refers, formatted as a string. */ -string NetAddress:: +std::string NetAddress:: get_ip_string() const { return _addr.get_ip(); } @@ -143,7 +143,7 @@ get_addr() const { * */ void NetAddress:: -output(ostream &out) const { +output(std::ostream &out) const { out << _addr.get_ip_port(); } diff --git a/panda/src/net/queuedConnectionReader.cxx b/panda/src/net/queuedConnectionReader.cxx index bdc562bd22..807b69337c 100644 --- a/panda/src/net/queuedConnectionReader.cxx +++ b/panda/src/net/queuedConnectionReader.cxx @@ -123,7 +123,7 @@ void QueuedConnectionReader:: start_delay(double min_delay, double max_delay) { LightMutexHolder holder(_dd_mutex); _min_delay = min_delay; - _delay_variance = max(max_delay - min_delay, 0.0); + _delay_variance = std::max(max_delay - min_delay, 0.0); _delay_active = true; } diff --git a/panda/src/net/test_datagram.cxx b/panda/src/net/test_datagram.cxx index db2f3fd305..93da4b6c87 100644 --- a/panda/src/net/test_datagram.cxx +++ b/panda/src/net/test_datagram.cxx @@ -14,6 +14,9 @@ #include "netDatagram.h" #include "datagramIterator.h" +using std::cout; +using std::endl; + int main() { NetDatagram dg; diff --git a/panda/src/net/test_raw_server.cxx b/panda/src/net/test_raw_server.cxx index aeec9b0aee..444d65756c 100644 --- a/panda/src/net/test_raw_server.cxx +++ b/panda/src/net/test_raw_server.cxx @@ -82,7 +82,7 @@ main(int argc, char *argv[]) { while (reader.data_available()) { NetDatagram datagram; if (reader.get_data(datagram)) { - string data = datagram.get_message(); + std::string data = datagram.get_message(); nout.write(data.data(), data.length()); nout << std::flush; diff --git a/panda/src/net/test_spam_client.cxx b/panda/src/net/test_spam_client.cxx index e76643e5c2..5488cec357 100644 --- a/panda/src/net/test_spam_client.cxx +++ b/panda/src/net/test_spam_client.cxx @@ -28,7 +28,7 @@ main(int argc, char *argv[]) { exit(1); } - string hostname = argv[1]; + std::string hostname = argv[1]; int port = atoi(argv[2]); NetAddress host; @@ -54,8 +54,8 @@ main(int argc, char *argv[]) { bool lost_connection = false; NetDatagram datagram; - cout << "Enter a datagram.\n"; - cin >> datagram; + std::cout << "Enter a datagram.\n"; + std::cin >> datagram; nout << "Read datagram " << datagram << "\n"; datagram.dump_hex(nout); diff --git a/panda/src/net/test_tcp_client.cxx b/panda/src/net/test_tcp_client.cxx index 4c5b15fa17..c88821149c 100644 --- a/panda/src/net/test_tcp_client.cxx +++ b/panda/src/net/test_tcp_client.cxx @@ -20,6 +20,9 @@ #include "datagram_ui.h" +using std::cin; +using std::cout; + int main(int argc, char *argv[]) { if (argc != 3) { @@ -27,7 +30,7 @@ main(int argc, char *argv[]) { exit(1); } - string hostname = argv[1]; + std::string hostname = argv[1]; int port = atoi(argv[2]); NetAddress host; diff --git a/panda/src/net/test_udp.cxx b/panda/src/net/test_udp.cxx index f069523f48..4aec3ecc76 100644 --- a/panda/src/net/test_udp.cxx +++ b/panda/src/net/test_udp.cxx @@ -20,6 +20,9 @@ #include "datagram_ui.h" +using std::cin; +using std::cout; + int main(int argc, char *argv[]) { if (argc != 3) { @@ -27,7 +30,7 @@ main(int argc, char *argv[]) { exit(1); } - string hostname = argv[1]; + std::string hostname = argv[1]; int port = atoi(argv[2]); NetAddress host; diff --git a/panda/src/ode/odeBody.cxx b/panda/src/ode/odeBody.cxx index 412759f8e7..70ad46169d 100644 --- a/panda/src/ode/odeBody.cxx +++ b/panda/src/ode/odeBody.cxx @@ -69,7 +69,7 @@ get_joint(int index) const { } void OdeBody:: -write(ostream &out, unsigned int indent) const { +write(std::ostream &out, unsigned int indent) const { out.width(indent); out << "" << get_type() \ << "(id = " << _id \ << ")"; diff --git a/panda/src/ode/odeGeom.cxx b/panda/src/ode/odeGeom.cxx index c291025912..e25c6c45b6 100644 --- a/panda/src/ode/odeGeom.cxx +++ b/panda/src/ode/odeGeom.cxx @@ -107,7 +107,7 @@ get_space() const { void OdeGeom:: -write(ostream &out, unsigned int indent) const { +write(std::ostream &out, unsigned int indent) const { out.width(indent); out << get_type() << "(id = " << _id << ")"; } diff --git a/panda/src/ode/odeJoint.cxx b/panda/src/ode/odeJoint.cxx index a089a7b303..dd10c57f0a 100644 --- a/panda/src/ode/odeJoint.cxx +++ b/panda/src/ode/odeJoint.cxx @@ -31,14 +31,14 @@ TypeHandle OdeJoint::_type_handle; OdeJoint:: OdeJoint() : _id(nullptr) { - ostream &out = odejoint_cat.debug(); + std::ostream &out = odejoint_cat.debug(); out << get_type() << "(" << _id << ")\n"; } OdeJoint:: OdeJoint(dJointID id) : _id(id) { - ostream &out = odejoint_cat.debug(); + std::ostream &out = odejoint_cat.debug(); out << get_type() << "(" << _id << ")\n"; } @@ -95,7 +95,7 @@ get_body(int index) const { } void OdeJoint:: -write(ostream &out, unsigned int indent) const { +write(std::ostream &out, unsigned int indent) const { out.width(indent); out << "" << get_type() \ << "(id = " << _id \ << ", body1 = "; diff --git a/panda/src/ode/odeMass.cxx b/panda/src/ode/odeMass.cxx index de9d52567a..76c3d360e8 100644 --- a/panda/src/ode/odeMass.cxx +++ b/panda/src/ode/odeMass.cxx @@ -51,7 +51,7 @@ operator = (const OdeMass ©) { void OdeMass:: -write(ostream &out, unsigned int indent) const { +write(std::ostream &out, unsigned int indent) const { out.width(indent); out << get_type() \ << "(mag = " << get_magnitude() \ diff --git a/panda/src/ode/odeSpace.cxx b/panda/src/ode/odeSpace.cxx index a07342b82f..f2beca8efb 100644 --- a/panda/src/ode/odeSpace.cxx +++ b/panda/src/ode/odeSpace.cxx @@ -95,7 +95,7 @@ get_geom(int i) { void OdeSpace:: -write(ostream &out, unsigned int indent) const { +write(std::ostream &out, unsigned int indent) const { out.width(indent); out << "" << get_type() << "(id = " << _id << ")"; } diff --git a/panda/src/ode/odeTriMeshData.cxx b/panda/src/ode/odeTriMeshData.cxx index 07d265a41d..4ca05ea17a 100644 --- a/panda/src/ode/odeTriMeshData.cxx +++ b/panda/src/ode/odeTriMeshData.cxx @@ -13,6 +13,8 @@ #include "odeTriMeshData.h" +using std::ostream; + TypeHandle OdeTriMeshData::_type_handle; OdeTriMeshData::TriMeshDataMap *OdeTriMeshData::_tri_mesh_data_map = nullptr; @@ -43,7 +45,7 @@ unlink_data(dGeomID id) { } void OdeTriMeshData:: -print_data(const string &marker) { +print_data(const std::string &marker) { odetrimeshdata_cat.debug() << get_class_type() << "::print_data(" << marker << ")\n"; const TriMeshDataMap &data_map = get_tri_mesh_data_map(); TriMeshDataMap::const_iterator iter = data_map.begin(); diff --git a/panda/src/ode/odeUtil.cxx b/panda/src/ode/odeUtil.cxx index 0e38b45558..2ae8d281d4 100644 --- a/panda/src/ode/odeUtil.cxx +++ b/panda/src/ode/odeUtil.cxx @@ -28,7 +28,7 @@ get_connecting_joint(const OdeBody &body1, const OdeBody &body2) { */ OdeJointCollection OdeUtil:: get_connecting_joint_list(const OdeBody &body1, const OdeBody &body2) { - const int max_possible_joints = min(body1.get_num_joints(), body1.get_num_joints()); + const int max_possible_joints = std::min(body1.get_num_joints(), body1.get_num_joints()); dJointID *joint_list = (dJointID *)PANDA_MALLOC_ARRAY(max_possible_joints * sizeof(dJointID)); int num_joints = dConnectingJointList(body1.get_id(), body2.get_id(), diff --git a/panda/src/osxdisplay/osxGraphicsBuffer.cxx b/panda/src/osxdisplay/osxGraphicsBuffer.cxx index d98b5d956a..03bfa46d79 100644 --- a/panda/src/osxdisplay/osxGraphicsBuffer.cxx +++ b/panda/src/osxdisplay/osxGraphicsBuffer.cxx @@ -25,7 +25,7 @@ TypeHandle osxGraphicsBuffer::_type_handle; */ osxGraphicsBuffer:: osxGraphicsBuffer(GraphicsEngine *engine, GraphicsPipe *pipe, - const string &name, + const std::string &name, const FrameBufferProperties &fb_prop, const WindowProperties &win_prop, int flags, diff --git a/panda/src/osxdisplay/osxGraphicsPipe.cxx b/panda/src/osxdisplay/osxGraphicsPipe.cxx index 9211c52515..5a56a6259d 100644 --- a/panda/src/osxdisplay/osxGraphicsPipe.cxx +++ b/panda/src/osxdisplay/osxGraphicsPipe.cxx @@ -202,7 +202,7 @@ osxGraphicsPipe:: * choose between several possible GraphicsPipes available on a particular * platform, so the name should be meaningful and unique for a given platform. */ -string osxGraphicsPipe:: +std::string osxGraphicsPipe:: get_interface_name() const { return "OpenGL"; } @@ -344,7 +344,7 @@ release_data(void *info, const void *data, size_t size) { * Creates a new window on the pipe, if possible. */ PT(GraphicsOutput) osxGraphicsPipe:: -make_output(const string &name, +make_output(const std::string &name, const FrameBufferProperties &fb_prop, const WindowProperties &win_prop, int flags, diff --git a/panda/src/osxdisplay/osxGraphicsStateGuardian.cxx b/panda/src/osxdisplay/osxGraphicsStateGuardian.cxx index 0ae735b055..2fb60d2d74 100644 --- a/panda/src/osxdisplay/osxGraphicsStateGuardian.cxx +++ b/panda/src/osxdisplay/osxGraphicsStateGuardian.cxx @@ -35,7 +35,7 @@ TypeHandle osxGraphicsStateGuardian::_type_handle; */ void *osxGraphicsStateGuardian:: do_get_extension_func(const char *name) { - string fullname = "_" + string(name); + std::string fullname = "_" + std::string(name); NSSymbol symbol = nullptr; if (NSIsSymbolNameDefined(fullname.c_str())) { @@ -113,8 +113,8 @@ draw_resize_box() { // Get the default texture to apply to the resize box; it's compiled into // the code. - string resize_box_string((const char *)resize_box, resize_box_len); - istringstream resize_box_strm(resize_box_string); + std::string resize_box_string((const char *)resize_box, resize_box_len); + std::istringstream resize_box_strm(resize_box_string); PNMImage resize_box_pnm; if (resize_box_pnm.read(resize_box_strm, "resize_box.rgb")) { PT(Texture) tex = new Texture; diff --git a/panda/src/parametrics/cubicCurveseg.cxx b/panda/src/parametrics/cubicCurveseg.cxx index 6bd2dcef6f..dcb5905cfa 100644 --- a/panda/src/parametrics/cubicCurveseg.cxx +++ b/panda/src/parametrics/cubicCurveseg.cxx @@ -234,7 +234,7 @@ compute_nurbs_basis(int order, if (mink==maxk) { // Huh. What were you thinking? This is a trivial NURBS. parametrics_cat->warning() - << "Trivial NURBS curve specified." << endl; + << "Trivial NURBS curve specified." << std::endl; memset((void *)&basis, 0, sizeof(LMatrix4)); return; } @@ -409,7 +409,7 @@ compute_seg_col(int c, break; default: - cerr << "Invalid rebuild type in compute_seg\n"; + std::cerr << "Invalid rebuild type in compute_seg\n"; return false; } diff --git a/panda/src/parametrics/curveFitter.cxx b/panda/src/parametrics/curveFitter.cxx index e929ebd21e..275a270a4b 100644 --- a/panda/src/parametrics/curveFitter.cxx +++ b/panda/src/parametrics/curveFitter.cxx @@ -137,8 +137,8 @@ get_sample_tangent(int n) const { */ void CurveFitter:: remove_samples(int begin, int end) { - begin = max(0, min((int)_data.size(), begin)); - end = max(0, min((int)_data.size(), end)); + begin = std::max(0, std::min((int)_data.size(), begin)); + end = std::max(0, std::min((int)_data.size(), end)); nassertv(begin <= end); @@ -411,7 +411,7 @@ make_nurbs() const { * */ void CurveFitter:: -output(ostream &out) const { +output(std::ostream &out) const { out << "CurveFitter, " << _data.size() << " samples.\n"; } @@ -419,7 +419,7 @@ output(ostream &out) const { * */ void CurveFitter:: -write(ostream &out) const { +write(std::ostream &out) const { out << "CurveFitter, " << _data.size() << " samples:\n"; Data::const_iterator di; for (di = _data.begin(); di != _data.end(); ++di) { diff --git a/panda/src/parametrics/hermiteCurve.cxx b/panda/src/parametrics/hermiteCurve.cxx index 73931ab001..7bb2399368 100644 --- a/panda/src/parametrics/hermiteCurve.cxx +++ b/panda/src/parametrics/hermiteCurve.cxx @@ -24,6 +24,9 @@ #include +using std::ostream; +using std::string; + TypeHandle HermiteCurve::_type_handle; static const LVecBase3 zerovec_3 = LVecBase3(0.0f, 0.0f, 0.0f); @@ -246,7 +249,7 @@ HermiteCurve(const ParametricCurve &nc) { if (!nc.convert_to_hermite(this)) { parametrics_cat->warning() << "Cannot make a Hermite from the indicated curve." - << endl; + << std::endl; } } @@ -291,7 +294,7 @@ insert_cv(PN_stdfloat t) { return n; } - t = min(max(t, (PN_stdfloat)0.0), get_max_t()); + t = std::min(std::max(t, (PN_stdfloat)0.0), get_max_t()); int n = find_cv(t); nassertr(n+1= 0 && n < get_num_cvs()); out << "CV " << n << ": " << get_cv_point(n) << ", weight " @@ -55,7 +55,7 @@ write_cv(ostream &out, int n) const { * */ void NurbsCurveInterface:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level); PN_stdfloat min_t = 0.0f; @@ -93,7 +93,7 @@ write(ostream &out, int indent_level) const { * Formats the Nurbs curve for output to an Egg file. */ bool NurbsCurveInterface:: -format_egg(ostream &out, const string &name, const string &curve_type, +format_egg(std::ostream &out, const std::string &name, const std::string &curve_type, int indent_level) const { indent(out, indent_level) << " " << name << ".pool {\n"; diff --git a/panda/src/parametrics/nurbsSurfaceEvaluator.cxx b/panda/src/parametrics/nurbsSurfaceEvaluator.cxx index 12ed399a9d..33d1ce0a81 100644 --- a/panda/src/parametrics/nurbsSurfaceEvaluator.cxx +++ b/panda/src/parametrics/nurbsSurfaceEvaluator.cxx @@ -212,7 +212,7 @@ evaluate(const NodePath &rel_to) const { * */ void NurbsSurfaceEvaluator:: -output(ostream &out) const { +output(std::ostream &out) const { out << "NurbsSurface, (" << get_num_u_knots() << ", " << get_num_v_knots() << ") knots."; } diff --git a/panda/src/parametrics/parametricCurve.cxx b/panda/src/parametrics/parametricCurve.cxx index 5d3d014722..9893c65604 100644 --- a/panda/src/parametrics/parametricCurve.cxx +++ b/panda/src/parametrics/parametricCurve.cxx @@ -321,8 +321,8 @@ write_egg(Filename filename, CoordinateSystem cs) { * stream. Returns true if the file is successfully written. */ bool ParametricCurve:: -write_egg(ostream &out, const Filename &filename, CoordinateSystem cs) { - string curve_type; +write_egg(std::ostream &out, const Filename &filename, CoordinateSystem cs) { + std::string curve_type; switch (get_curve_type()) { case PCT_XYZ: curve_type = "xyz"; @@ -339,7 +339,7 @@ write_egg(ostream &out, const Filename &filename, CoordinateSystem cs) { if (!has_name()) { // If we don't have a name, come up with one. - string name = filename.get_basename_wo_extension(); + std::string name = filename.get_basename_wo_extension(); if (!curve_type.empty()) { name += "_"; @@ -602,7 +602,7 @@ invalidate_all() { * Returns true on success, false on failure. */ bool ParametricCurve:: -format_egg(ostream &, const string &, const string &, int) const { +format_egg(std::ostream &, const std::string &, const std::string &, int) const { return false; } diff --git a/panda/src/parametrics/parametricCurveCollection.cxx b/panda/src/parametrics/parametricCurveCollection.cxx index 9e3d8b4a1b..96ce9bd503 100644 --- a/panda/src/parametrics/parametricCurveCollection.cxx +++ b/panda/src/parametrics/parametricCurveCollection.cxx @@ -44,7 +44,7 @@ add_curve(ParametricCurve *curve) { void ParametricCurveCollection:: insert_curve(size_t index, ParametricCurve *curve) { prepare_add_curve(curve); - index = min(index, _curves.size()); + index = std::min(index, _curves.size()); _curves.insert(_curves.begin() + index, curve); redraw(); } @@ -307,7 +307,7 @@ make_even(PN_stdfloat max_t, PN_stdfloat segments_per_unit) { // the same length as all the others. CurveFitter fitter; - int num_segments = max(1, (int)cfloor(segments_per_unit * xyz_curve->get_max_t() + 0.5f)); + int num_segments = std::max(1, (int)cfloor(segments_per_unit * xyz_curve->get_max_t() + 0.5f)); if (parametrics_cat.is_debug()) { parametrics_cat.debug() @@ -657,7 +657,7 @@ stitch(const ParametricCurveCollection *a, * indicated output stream. */ void ParametricCurveCollection:: -output(ostream &out) const { +output(std::ostream &out) const { if (get_num_curves() == 1) { out << "1 ParametricCurve"; } else { @@ -670,7 +670,7 @@ output(ostream &out) const { * to the indicated output stream. */ void ParametricCurveCollection:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { ParametricCurves::const_iterator ci; for (ci = _curves.begin(); ci != _curves.end(); ++ci) { ParametricCurve *curve = (*ci); @@ -700,7 +700,7 @@ write_egg(Filename filename, CoordinateSystem cs) { * specified output stream. Returns true if the file is successfully written. */ bool ParametricCurveCollection:: -write_egg(ostream &out, const Filename &filename, CoordinateSystem cs) { +write_egg(std::ostream &out, const Filename &filename, CoordinateSystem cs) { if (cs == CS_default) { cs = get_default_coordinate_system(); } @@ -740,7 +740,7 @@ write_egg(ostream &out, const Filename &filename, CoordinateSystem cs) { if (!curve->has_name()) { // If we don't have a name, come up with one. - string name = filename.get_basename_wo_extension(); + std::string name = filename.get_basename_wo_extension(); switch (curve->get_curve_type()) { case PCT_XYZ: diff --git a/panda/src/parametrics/piecewiseCurve.cxx b/panda/src/parametrics/piecewiseCurve.cxx index d69b4f7025..f5e2fadad9 100644 --- a/panda/src/parametrics/piecewiseCurve.cxx +++ b/panda/src/parametrics/piecewiseCurve.cxx @@ -20,6 +20,8 @@ #include "bamWriter.h" #include "bamReader.h" +using std::cerr; + TypeHandle PiecewiseCurve::_type_handle; /** diff --git a/panda/src/parametrics/ropeNode.cxx b/panda/src/parametrics/ropeNode.cxx index 5837bfd361..ffb2c83119 100644 --- a/panda/src/parametrics/ropeNode.cxx +++ b/panda/src/parametrics/ropeNode.cxx @@ -67,7 +67,7 @@ fillin(DatagramIterator &scan, BamReader *reader) { * */ RopeNode:: -RopeNode(const string &name) : +RopeNode(const std::string &name) : PandaNode(name) { set_cull_callback(); @@ -177,7 +177,7 @@ is_renderable() const { * */ void RopeNode:: -output(ostream &out) const { +output(std::ostream &out) const { PandaNode::output(out); NurbsCurveEvaluator *curve = get_curve(); if (curve != nullptr) { @@ -191,7 +191,7 @@ output(ostream &out) const { * */ void RopeNode:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { PandaNode::write(out, indent_level); indent(out, indent_level) << *get_curve() << "\n"; } diff --git a/panda/src/parametrics/sheetNode.cxx b/panda/src/parametrics/sheetNode.cxx index 294c3a7ff4..eec44c0cda 100644 --- a/panda/src/parametrics/sheetNode.cxx +++ b/panda/src/parametrics/sheetNode.cxx @@ -66,7 +66,7 @@ fillin(DatagramIterator &scan, BamReader *reader) { * */ SheetNode:: -SheetNode(const string &name) : +SheetNode(const std::string &name) : PandaNode(name) { set_cull_callback(); @@ -155,7 +155,7 @@ is_renderable() const { * */ void SheetNode:: -output(ostream &out) const { +output(std::ostream &out) const { PandaNode::output(out); NurbsSurfaceEvaluator *surface = get_surface(); if (surface != nullptr) { @@ -169,7 +169,7 @@ output(ostream &out) const { * */ void SheetNode:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { PandaNode::write(out, indent_level); NurbsSurfaceEvaluator *surface = get_surface(); if (surface != nullptr) { diff --git a/panda/src/particlesystem/arcEmitter.cxx b/panda/src/particlesystem/arcEmitter.cxx index cc56b3130e..a87c7376db 100644 --- a/panda/src/particlesystem/arcEmitter.cxx +++ b/panda/src/particlesystem/arcEmitter.cxx @@ -74,7 +74,7 @@ assign_initial_position(LPoint3& pos) { * Write a starc representation of this instance to . */ void ArcEmitter:: -output(ostream &out) const { +output(std::ostream &out) const { #ifndef NDEBUG //[ out<<"ArcEmitter"; #endif //] NDEBUG @@ -84,7 +84,7 @@ output(ostream &out) const { * Write a starc representation of this instance to . */ void ArcEmitter:: -write(ostream &out, int indent) const { +write(std::ostream &out, int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""; out<<"ArcEmitter:\n"; out.width(indent+2); out<<""; out<<"_start_angle "<. */ void BaseParticle:: -output(ostream &out) const { +output(std::ostream &out) const { #ifndef NDEBUG //[ out<<"BaseParticle"; #endif //] NDEBUG @@ -61,7 +61,7 @@ output(ostream &out) const { * Write a string representation of this instance to . */ void BaseParticle:: -write(ostream &out, int indent) const { +write(std::ostream &out, int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""; out<<"BaseParticle:\n"; out.width(indent+2); out<<""; out<<"_age "<<_age<<"\n"; diff --git a/panda/src/particlesystem/baseParticleEmitter.cxx b/panda/src/particlesystem/baseParticleEmitter.cxx index 20ef762aa9..c18584b461 100644 --- a/panda/src/particlesystem/baseParticleEmitter.cxx +++ b/panda/src/particlesystem/baseParticleEmitter.cxx @@ -79,7 +79,7 @@ generate(LPoint3& pos, LVector3& vel) { * Write a string representation of this instance to . */ void BaseParticleEmitter:: -output(ostream &out) const { +output(std::ostream &out) const { #ifndef NDEBUG //[ out<<"BaseParticleEmitter"; #endif //] NDEBUG @@ -89,7 +89,7 @@ output(ostream &out) const { * Write a string representation of this instance to . */ void BaseParticleEmitter:: -write(ostream &out, int indent) const { +write(std::ostream &out, int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""; out<<"BaseParticleEmitter:\n"; out.width(indent+2); out<<""; out<<"_emission_type "<<_emission_type<<"\n"; diff --git a/panda/src/particlesystem/baseParticleFactory.cxx b/panda/src/particlesystem/baseParticleFactory.cxx index 162b4df88e..0f0169f99b 100644 --- a/panda/src/particlesystem/baseParticleFactory.cxx +++ b/panda/src/particlesystem/baseParticleFactory.cxx @@ -69,7 +69,7 @@ populate_particle(BaseParticle *bp) { * Write a string representation of this instance to . */ void BaseParticleFactory:: -output(ostream &out) const { +output(std::ostream &out) const { #ifndef NDEBUG //[ out<<"BaseParticleFactory"; #endif //] NDEBUG @@ -79,7 +79,7 @@ output(ostream &out) const { * Write a string representation of this instance to . */ void BaseParticleFactory:: -write(ostream &out, int indent) const { +write(std::ostream &out, int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""; out<<"BaseParticleFactory:\n"; out.width(indent+2); out<<""; out<<"_lifespan_base "<<_lifespan_base<<"\n"; diff --git a/panda/src/particlesystem/baseParticleRenderer.cxx b/panda/src/particlesystem/baseParticleRenderer.cxx index 2a2072c2a1..f7f33c41ac 100644 --- a/panda/src/particlesystem/baseParticleRenderer.cxx +++ b/panda/src/particlesystem/baseParticleRenderer.cxx @@ -79,7 +79,7 @@ set_ignore_scale(bool ignore_scale) { * Write a string representation of this instance to . */ void BaseParticleRenderer:: -output(ostream &out) const { +output(std::ostream &out) const { #ifndef NDEBUG //[ out<<"BaseParticleRenderer"; #endif //] NDEBUG @@ -89,7 +89,7 @@ output(ostream &out) const { * Write a string representation of this instance to . */ void BaseParticleRenderer:: -write(ostream &out, int indent) const { +write(std::ostream &out, int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""; out<<"BaseParticleRenderer:\n"; out.width(indent+2); out<<""; out<<"_render_node "<<_render_node_path<<"\n"; diff --git a/panda/src/particlesystem/boxEmitter.cxx b/panda/src/particlesystem/boxEmitter.cxx index 52035e62c7..3b84932dd7 100644 --- a/panda/src/particlesystem/boxEmitter.cxx +++ b/panda/src/particlesystem/boxEmitter.cxx @@ -78,7 +78,7 @@ assign_initial_velocity(LVector3& vel) { * Write a string representation of this instance to . */ void BoxEmitter:: -output(ostream &out) const { +output(std::ostream &out) const { #ifndef NDEBUG //[ out<<"BoxEmitter"; #endif //] NDEBUG @@ -88,7 +88,7 @@ output(ostream &out) const { * Write a string representation of this instance to . */ void BoxEmitter:: -write(ostream &out, int indent) const { +write(std::ostream &out, int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""; out<<"BoxEmitter:\n"; out.width(indent+2); out<<""; out<<"_vmin "<<_vmin<<"\n"; diff --git a/panda/src/particlesystem/colorInterpolationManager.cxx b/panda/src/particlesystem/colorInterpolationManager.cxx index 27268c2ef8..b2e68ba66d 100644 --- a/panda/src/particlesystem/colorInterpolationManager.cxx +++ b/panda/src/particlesystem/colorInterpolationManager.cxx @@ -14,6 +14,9 @@ #include "colorInterpolationManager.h" #include "mathNumbers.h" +using std::max; +using std::min; + TypeHandle ColorInterpolationFunction::_type_handle; TypeHandle ColorInterpolationFunctionConstant::_type_handle; TypeHandle ColorInterpolationFunctionLinear::_type_handle; diff --git a/panda/src/particlesystem/discEmitter.cxx b/panda/src/particlesystem/discEmitter.cxx index 3b018a2dfe..e07f933bdf 100644 --- a/panda/src/particlesystem/discEmitter.cxx +++ b/panda/src/particlesystem/discEmitter.cxx @@ -115,7 +115,7 @@ assign_initial_velocity(LVector3& vel) { * Write a string representation of this instance to . */ void DiscEmitter:: -output(ostream &out) const { +output(std::ostream &out) const { #ifndef NDEBUG //[ out<<"DiscEmitter"; #endif //] NDEBUG @@ -125,7 +125,7 @@ output(ostream &out) const { * Write a string representation of this instance to . */ void DiscEmitter:: -write(ostream &out, int indent) const { +write(std::ostream &out, int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""; out<<"DiscEmitter:\n"; out.width(indent+2); out<<""; out<<"_radius "<<_radius<<"\n"; diff --git a/panda/src/particlesystem/geomParticleRenderer.cxx b/panda/src/particlesystem/geomParticleRenderer.cxx index 74df181f2e..8db733c58d 100644 --- a/panda/src/particlesystem/geomParticleRenderer.cxx +++ b/panda/src/particlesystem/geomParticleRenderer.cxx @@ -200,7 +200,7 @@ render(pvector< PT(PhysicsObject) >& po_vector, int ttl_particles) { if (_alpha_mode == PR_ALPHA_OUT) alpha_scalar = 1.0f - alpha_scalar; else if (_alpha_mode == PR_ALPHA_IN_OUT) - alpha_scalar = 2.0f * min(alpha_scalar, 1.0f - alpha_scalar); + alpha_scalar = 2.0f * std::min(alpha_scalar, 1.0f - alpha_scalar); alpha_scalar *= get_user_alpha(); } @@ -252,7 +252,7 @@ render(pvector< PT(PhysicsObject) >& po_vector, int ttl_particles) { * Write a string representation of this instance to . */ void GeomParticleRenderer:: -output(ostream &out) const { +output(std::ostream &out) const { #ifndef NDEBUG //[ out<<"GeomParticleRenderer"; #endif //] NDEBUG @@ -262,7 +262,7 @@ output(ostream &out) const { * Write a string representation of this instance to . */ void GeomParticleRenderer:: -write_linear_forces(ostream &out, int indent) const { +write_linear_forces(std::ostream &out, int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""<<"_node_vector ("<<_node_vector.size()<<" forces)\n"; @@ -278,7 +278,7 @@ write_linear_forces(ostream &out, int indent) const { * Write a string representation of this instance to . */ void GeomParticleRenderer:: -write(ostream &out, int indent) const { +write(std::ostream &out, int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""; out<<"GeomParticleRenderer:\n"; out.width(indent+2); out<<""; out<<"_geom_node "<<_geom_node<<"\n"; diff --git a/panda/src/particlesystem/lineEmitter.cxx b/panda/src/particlesystem/lineEmitter.cxx index 5a236c03e1..6855fc3aeb 100644 --- a/panda/src/particlesystem/lineEmitter.cxx +++ b/panda/src/particlesystem/lineEmitter.cxx @@ -76,7 +76,7 @@ assign_initial_velocity(LVector3& vel) { * Write a string representation of this instance to . */ void LineEmitter:: -output(ostream &out) const { +output(std::ostream &out) const { #ifndef NDEBUG //[ out<<"LineEmitter"; #endif //] NDEBUG @@ -86,7 +86,7 @@ output(ostream &out) const { * Write a string representation of this instance to . */ void LineEmitter:: -write(ostream &out, int indent) const { +write(std::ostream &out, int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""; out<<"LineEmitter:\n"; out.width(indent+2); out<<""; out<<"_endpoint1 "<<_endpoint1<<"\n"; diff --git a/panda/src/particlesystem/lineParticleRenderer.cxx b/panda/src/particlesystem/lineParticleRenderer.cxx index e139e6f2e8..5a2240cfb6 100644 --- a/panda/src/particlesystem/lineParticleRenderer.cxx +++ b/panda/src/particlesystem/lineParticleRenderer.cxx @@ -195,7 +195,7 @@ render(pvector< PT(PhysicsObject) >& po_vector, int ttl_particles) { if (_alpha_mode == PR_ALPHA_OUT) alpha = 1.0f - alpha; else if (_alpha_mode == PR_ALPHA_IN_OUT) - alpha = 2.0f * min(alpha, 1.0f - alpha); + alpha = 2.0f * std::min(alpha, 1.0f - alpha); } head_color[3] = alpha; @@ -232,7 +232,7 @@ render(pvector< PT(PhysicsObject) >& po_vector, int ttl_particles) { * Write a string representation of this instance to . */ void LineParticleRenderer:: -output(ostream &out) const { +output(std::ostream &out) const { #ifndef NDEBUG //[ out<<"LineParticleRenderer"; #endif //] NDEBUG @@ -242,7 +242,7 @@ output(ostream &out) const { * Write a string representation of this instance to . */ void LineParticleRenderer:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << "LineParticleRenderer:\n"; indent(out, indent_level + 2) << "_head_color "<<_head_color<<"\n"; indent(out, indent_level + 2) << "_tail_color "<<_tail_color<<"\n"; diff --git a/panda/src/particlesystem/orientedParticle.cxx b/panda/src/particlesystem/orientedParticle.cxx index bf828f165c..640c244aa7 100644 --- a/panda/src/particlesystem/orientedParticle.cxx +++ b/panda/src/particlesystem/orientedParticle.cxx @@ -71,7 +71,7 @@ update() { * Write a string representation of this instance to . */ void OrientedParticle:: -output(ostream &out) const { +output(std::ostream &out) const { #ifndef NDEBUG //[ out<<"OrientedParticle"; #endif //] NDEBUG @@ -81,7 +81,7 @@ output(ostream &out) const { * Write a string representation of this instance to . */ void OrientedParticle:: -write(ostream &out, int indent) const { +write(std::ostream &out, int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""; out<<"OrientedParticle:\n"; BaseParticle::write(out, indent+2); diff --git a/panda/src/particlesystem/orientedParticleFactory.cxx b/panda/src/particlesystem/orientedParticleFactory.cxx index 2889a16727..7276d9c2b9 100644 --- a/panda/src/particlesystem/orientedParticleFactory.cxx +++ b/panda/src/particlesystem/orientedParticleFactory.cxx @@ -59,7 +59,7 @@ alloc_particle() const { * Write a string representation of this instance to . */ void OrientedParticleFactory:: -output(ostream &out) const { +output(std::ostream &out) const { #ifndef NDEBUG //[ out<<"OrientedParticleFactory"; #endif //] NDEBUG @@ -69,7 +69,7 @@ output(ostream &out) const { * Write a string representation of this instance to . */ void OrientedParticleFactory:: -write(ostream &out, int indent) const { +write(std::ostream &out, int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""; out<<"OrientedParticleFactory:\n"; BaseParticleFactory::write(out, indent+2); diff --git a/panda/src/particlesystem/particleSystem.cxx b/panda/src/particlesystem/particleSystem.cxx index 7e22ac9180..32a9480fc0 100644 --- a/panda/src/particlesystem/particleSystem.cxx +++ b/panda/src/particlesystem/particleSystem.cxx @@ -30,6 +30,10 @@ #include "sphereSurfaceEmitter.h" #include "pStatTimer.h" +using std::cout; +using std::endl; +using std::ostream; + TypeHandle ParticleSystem::_type_handle; PStatCollector ParticleSystem::_update_collector("App:Particles:Update"); @@ -594,7 +598,7 @@ sanity_check() { #endif result++; } - pool_size = min(_particle_pool_size, _physics_objects.size()); + pool_size = std::min(_particle_pool_size, _physics_objects.size()); // find out how many particles are REALLY alive and dead int real_live_particle_count = 0; diff --git a/panda/src/particlesystem/particleSystemManager.cxx b/panda/src/particlesystem/particleSystemManager.cxx index e6dbf53fef..b96c7d6105 100644 --- a/panda/src/particlesystem/particleSystemManager.cxx +++ b/panda/src/particlesystem/particleSystemManager.cxx @@ -145,7 +145,7 @@ do_particles(PN_stdfloat dt, ParticleSystem *ps, bool do_render) { * Write a string representation of this instance to . */ void ParticleSystemManager:: -output(ostream &out) const { +output(std::ostream &out) const { #ifndef NDEBUG //[ out<<"ParticleSystemManager"; #endif //] NDEBUG @@ -155,7 +155,7 @@ output(ostream &out) const { * Write a string representation of this instance to . */ void ParticleSystemManager:: -write_ps_list(ostream &out, int indent) const { +write_ps_list(std::ostream &out, int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""<<"_ps_list ("<<_ps_list.size()<<" systems)\n"; @@ -171,7 +171,7 @@ write_ps_list(ostream &out, int indent) const { * Write a string representation of this instance to . */ void ParticleSystemManager:: -write(ostream &out, int indent) const { +write(std::ostream &out, int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""; out<<"ParticleSystemManager:\n"; out.width(indent+2); out<<""; out<<"_nth_frame "<<_nth_frame<<"\n"; diff --git a/panda/src/particlesystem/pointEmitter.cxx b/panda/src/particlesystem/pointEmitter.cxx index 9c3664e7c7..376cec9a82 100644 --- a/panda/src/particlesystem/pointEmitter.cxx +++ b/panda/src/particlesystem/pointEmitter.cxx @@ -66,7 +66,7 @@ assign_initial_velocity(LVector3& vel) { * Write a string representation of this instance to . */ void PointEmitter:: -output(ostream &out) const { +output(std::ostream &out) const { #ifndef NDEBUG //[ out<<"PointEmitter"; #endif //] NDEBUG @@ -76,7 +76,7 @@ output(ostream &out) const { * Write a string representation of this instance to . */ void PointEmitter:: -write(ostream &out, int indent) const { +write(std::ostream &out, int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""; out<<"PointEmitter:\n"; out.width(indent+2); out<<""; out<<"_location "<<_location<<"\n"; diff --git a/panda/src/particlesystem/pointParticle.cxx b/panda/src/particlesystem/pointParticle.cxx index 32e1dbf0b2..fac3c5edf2 100644 --- a/panda/src/particlesystem/pointParticle.cxx +++ b/panda/src/particlesystem/pointParticle.cxx @@ -71,7 +71,7 @@ update() { * Write a string representation of this instance to . */ void PointParticle:: -output(ostream &out) const { +output(std::ostream &out) const { #ifndef NDEBUG //[ out<<"PointParticle"; #endif //] NDEBUG @@ -81,7 +81,7 @@ output(ostream &out) const { * Write a string representation of this instance to . */ void PointParticle:: -write(ostream &out, int indent) const { +write(std::ostream &out, int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""; out<<"PointParticle:\n"; BaseParticle::write(out, indent+2); diff --git a/panda/src/particlesystem/pointParticleFactory.cxx b/panda/src/particlesystem/pointParticleFactory.cxx index 71a06d763e..2e1b645d88 100644 --- a/panda/src/particlesystem/pointParticleFactory.cxx +++ b/panda/src/particlesystem/pointParticleFactory.cxx @@ -59,7 +59,7 @@ alloc_particle() const { * Write a string representation of this instance to . */ void PointParticleFactory:: -output(ostream &out) const { +output(std::ostream &out) const { #ifndef NDEBUG //[ out<<"PointParticleFactory"; #endif //] NDEBUG @@ -69,7 +69,7 @@ output(ostream &out) const { * Write a string representation of this instance to . */ void PointParticleFactory:: -write(ostream &out, int indent) const { +write(std::ostream &out, int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""; out<<"PointParticleFactory:\n"; BaseParticleFactory::write(out, indent+2); diff --git a/panda/src/particlesystem/pointParticleRenderer.cxx b/panda/src/particlesystem/pointParticleRenderer.cxx index 2a5d345d37..04374bf536 100644 --- a/panda/src/particlesystem/pointParticleRenderer.cxx +++ b/panda/src/particlesystem/pointParticleRenderer.cxx @@ -167,7 +167,7 @@ create_color(const BaseParticle *p) { if (_alpha_mode == PR_ALPHA_OUT) { parameterized_age = 1.0f - parameterized_age; } else if (_alpha_mode == PR_ALPHA_IN_OUT) { - parameterized_age = 2.0f * min(parameterized_age, + parameterized_age = 2.0f * std::min(parameterized_age, 1.0f - parameterized_age); } } @@ -257,7 +257,7 @@ render(pvector< PT(PhysicsObject) >& po_vector, int ttl_particles) { * Write a string representation of this instance to . */ void PointParticleRenderer:: -output(ostream &out) const { +output(std::ostream &out) const { #ifndef NDEBUG //[ out<<"PointParticleRenderer"; #endif //] NDEBUG @@ -267,7 +267,7 @@ output(ostream &out) const { * Write a string representation of this instance to . */ void PointParticleRenderer:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << "PointParticleRenderer:\n"; indent(out, indent_level + 2) << "_start_color "<<_start_color<<"\n"; indent(out, indent_level + 2) << "_end_color "<<_end_color<<"\n"; diff --git a/panda/src/particlesystem/rectangleEmitter.cxx b/panda/src/particlesystem/rectangleEmitter.cxx index f261662486..d23de128e3 100644 --- a/panda/src/particlesystem/rectangleEmitter.cxx +++ b/panda/src/particlesystem/rectangleEmitter.cxx @@ -76,7 +76,7 @@ assign_initial_velocity(LVector3& vel) { * Write a string representation of this instance to . */ void RectangleEmitter:: -output(ostream &out) const { +output(std::ostream &out) const { #ifndef NDEBUG //[ out<<"RectangleEmitter"; #endif //] NDEBUG @@ -86,7 +86,7 @@ output(ostream &out) const { * Write a string representation of this instance to . */ void RectangleEmitter:: -write(ostream &out, int indent) const { +write(std::ostream &out, int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""; out<<"RectangleEmitter:\n"; out.width(indent+2); out<<""; out<<"_vmin "<<_vmin<<"\n"; diff --git a/panda/src/particlesystem/ringEmitter.cxx b/panda/src/particlesystem/ringEmitter.cxx index c9f7009807..1c4e4ee5fd 100644 --- a/panda/src/particlesystem/ringEmitter.cxx +++ b/panda/src/particlesystem/ringEmitter.cxx @@ -105,7 +105,7 @@ assign_initial_velocity(LVector3& vel) { * Write a string representation of this instance to . */ void RingEmitter:: -output(ostream &out) const { +output(std::ostream &out) const { #ifndef NDEBUG //[ out<<"RingEmitter"; #endif //] NDEBUG @@ -115,7 +115,7 @@ output(ostream &out) const { * Write a string representation of this instance to . */ void RingEmitter:: -write(ostream &out, int indent) const { +write(std::ostream &out, int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""; out<<"RingEmitter:\n"; out.width(indent+2); out<<""; out<<"_radius "<<_radius<<"\n"; diff --git a/panda/src/particlesystem/sparkleParticleRenderer.cxx b/panda/src/particlesystem/sparkleParticleRenderer.cxx index 5dc2d0772b..63a7124b59 100644 --- a/panda/src/particlesystem/sparkleParticleRenderer.cxx +++ b/panda/src/particlesystem/sparkleParticleRenderer.cxx @@ -192,7 +192,7 @@ render(pvector< PT(PhysicsObject) >& po_vector, int ttl_particles) { if (_alpha_mode == PR_ALPHA_OUT) alpha = 1.0f - alpha; else if (_alpha_mode == PR_ALPHA_IN_OUT) - alpha = 2.0f * min(alpha, 1.0f - alpha); + alpha = 2.0f * std::min(alpha, 1.0f - alpha); alpha *= get_user_alpha(); } @@ -262,7 +262,7 @@ render(pvector< PT(PhysicsObject) >& po_vector, int ttl_particles) { * Write a string representation of this instance to . */ void SparkleParticleRenderer:: -output(ostream &out) const { +output(std::ostream &out) const { #ifndef NDEBUG //[ out<<"SparkleParticleRenderer"; #endif //] NDEBUG @@ -272,7 +272,7 @@ output(ostream &out) const { * Write a string representation of this instance to . */ void SparkleParticleRenderer:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << "SparkleParticleRenderer:\n"; indent(out, indent_level + 2) << "_center_color "<<_center_color<<"\n"; indent(out, indent_level + 2) << "_edge_color "<<_edge_color<<"\n"; diff --git a/panda/src/particlesystem/sphereSurfaceEmitter.cxx b/panda/src/particlesystem/sphereSurfaceEmitter.cxx index 37b6a274fb..9fc67113a8 100644 --- a/panda/src/particlesystem/sphereSurfaceEmitter.cxx +++ b/panda/src/particlesystem/sphereSurfaceEmitter.cxx @@ -71,7 +71,7 @@ assign_initial_velocity(LVector3& vel) { * Write a string representation of this instance to . */ void SphereSurfaceEmitter:: -output(ostream &out) const { +output(std::ostream &out) const { #ifndef NDEBUG //[ out<<"SphereSurfaceEmitter"; #endif //] NDEBUG @@ -81,7 +81,7 @@ output(ostream &out) const { * Write a string representation of this instance to . */ void SphereSurfaceEmitter:: -write(ostream &out, int indent) const { +write(std::ostream &out, int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""; out<<"SphereSurfaceEmitter:\n"; out.width(indent+2); out<<""; out<<"_radius "<<_radius<<"\n"; diff --git a/panda/src/particlesystem/sphereVolumeEmitter.cxx b/panda/src/particlesystem/sphereVolumeEmitter.cxx index 5b541ce220..985b96c21d 100644 --- a/panda/src/particlesystem/sphereVolumeEmitter.cxx +++ b/panda/src/particlesystem/sphereVolumeEmitter.cxx @@ -85,7 +85,7 @@ assign_initial_velocity(LVector3& vel) { * Write a string representation of this instance to . */ void SphereVolumeEmitter:: -output(ostream &out) const { +output(std::ostream &out) const { #ifndef NDEBUG //[ out<<"SphereVolumeEmitter"; #endif //] NDEBUG @@ -95,7 +95,7 @@ output(ostream &out) const { * Write a string representation of this instance to . */ void SphereVolumeEmitter:: -write(ostream &out, int indent) const { +write(std::ostream &out, int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""; out<<"SphereVolumeEmitter:\n"; out.width(indent+2); out<<""; out<<"_radius "<<_radius<<"\n"; diff --git a/panda/src/particlesystem/spriteParticleRenderer.cxx b/panda/src/particlesystem/spriteParticleRenderer.cxx index 58cec0e50a..9aa9c77e52 100644 --- a/panda/src/particlesystem/spriteParticleRenderer.cxx +++ b/panda/src/particlesystem/spriteParticleRenderer.cxx @@ -30,6 +30,9 @@ #include "config_particlesystem.h" #include "pStatTimer.h" +using std::max; +using std::min; + PStatCollector SpriteParticleRenderer::_render_collector("App:Particles:Sprite:Render"); /** @@ -189,7 +192,7 @@ extract_textures_from_node(const NodePath &node_path, NodePathCollection &np_col * match the new geometry. */ void SpriteParticleRenderer:: -set_from_node(const NodePath &node_path, const string &model, const string &node, bool size_from_texels) { +set_from_node(const NodePath &node_path, const std::string &model, const std::string &node, bool size_from_texels) { // Clear all texture information _anims.clear(); add_from_node(node_path,model,node,size_from_texels,true); @@ -241,7 +244,7 @@ set_from_node(const NodePath &node_path, bool size_from_texels) { * now on. (Default is false) */ void SpriteParticleRenderer:: -add_from_node(const NodePath &node_path, const string &model, const string &node, bool size_from_texels, bool resize) { +add_from_node(const NodePath &node_path, const std::string &model, const std::string &node, bool size_from_texels, bool resize) { int anim_count = _anims.size(); if (anim_count == 0) resize = true; @@ -744,7 +747,7 @@ render(pvector< PT(PhysicsObject) >& po_vector, int ttl_particles) { * Write a string representation of this instance to . */ void SpriteParticleRenderer:: -output(ostream &out) const { +output(std::ostream &out) const { #ifndef NDEBUG //[ out<<"SpriteParticleRenderer"; #endif //] NDEBUG @@ -754,7 +757,7 @@ output(ostream &out) const { * Write a string representation of this instance to . */ void SpriteParticleRenderer:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << "SpriteParticleRenderer:\n"; // indent(out, indent_level + 2) << "_sprite_primitive // "<<_sprite_primitive<<"\n"; diff --git a/panda/src/particlesystem/tangentRingEmitter.cxx b/panda/src/particlesystem/tangentRingEmitter.cxx index 5c77c5491e..13bbf6f8bc 100644 --- a/panda/src/particlesystem/tangentRingEmitter.cxx +++ b/panda/src/particlesystem/tangentRingEmitter.cxx @@ -73,7 +73,7 @@ assign_initial_velocity(LVector3& vel) { * Write a string representation of this instance to . */ void TangentRingEmitter:: -output(ostream &out) const { +output(std::ostream &out) const { #ifndef NDEBUG //[ out<<"TangentRingEmitter"; #endif //] NDEBUG @@ -83,7 +83,7 @@ output(ostream &out) const { * Write a string representation of this instance to . */ void TangentRingEmitter:: -write(ostream &out, int indent) const { +write(std::ostream &out, int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""; out<<"TangentRingEmitter:\n"; out.width(indent+2); out<<""; out<<"_radius "<<_radius<<"\n"; diff --git a/panda/src/particlesystem/zSpinParticle.cxx b/panda/src/particlesystem/zSpinParticle.cxx index 560fa12a72..7808c2833e 100644 --- a/panda/src/particlesystem/zSpinParticle.cxx +++ b/panda/src/particlesystem/zSpinParticle.cxx @@ -108,7 +108,7 @@ get_theta() const { * Write a string representation of this instance to . */ void ZSpinParticle:: -output(ostream &out) const { +output(std::ostream &out) const { #ifndef NDEBUG //[ out<<"ZSpinParticle"; #endif //] NDEBUG @@ -118,7 +118,7 @@ output(ostream &out) const { * Write a string representation of this instance to . */ void ZSpinParticle:: -write(ostream &out, int indent) const { +write(std::ostream &out, int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""; out<<"ZSpinParticle:\n"; out.width(indent+2); out<<""; out<<"_initial_angle "<<_initial_angle<<"\n"; diff --git a/panda/src/particlesystem/zSpinParticleFactory.cxx b/panda/src/particlesystem/zSpinParticleFactory.cxx index f8c21efccb..5f260714d7 100644 --- a/panda/src/particlesystem/zSpinParticleFactory.cxx +++ b/panda/src/particlesystem/zSpinParticleFactory.cxx @@ -76,7 +76,7 @@ populate_child_particle(BaseParticle *bp) const { * Write a string representation of this instance to . */ void ZSpinParticleFactory:: -output(ostream &out) const { +output(std::ostream &out) const { #ifndef NDEBUG //[ out<<"ZSpinParticleFactory"; #endif //] NDEBUG @@ -86,7 +86,7 @@ output(ostream &out) const { * Write a string representation of this instance to . */ void ZSpinParticleFactory:: -write(ostream &out, int indent) const { +write(std::ostream &out, int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""; out<<"ZSpinParticleFactory:\n"; out.width(indent+2); out<<""; out<<"_initial_angle "<<_initial_angle<<"\n"; diff --git a/panda/src/pgraph/accumulatedAttribs.cxx b/panda/src/pgraph/accumulatedAttribs.cxx index f82ec15d03..94faa3072a 100644 --- a/panda/src/pgraph/accumulatedAttribs.cxx +++ b/panda/src/pgraph/accumulatedAttribs.cxx @@ -85,7 +85,7 @@ operator = (const AccumulatedAttribs ©) { * */ void AccumulatedAttribs:: -write(ostream &out, int attrib_types, int indent_level) const { +write(std::ostream &out, int attrib_types, int indent_level) const { if ((attrib_types & SceneGraphReducer::TT_transform) != 0) { _transform->write(out, indent_level); } diff --git a/panda/src/pgraph/alphaTestAttrib.cxx b/panda/src/pgraph/alphaTestAttrib.cxx index a302026623..331b709478 100644 --- a/panda/src/pgraph/alphaTestAttrib.cxx +++ b/panda/src/pgraph/alphaTestAttrib.cxx @@ -46,7 +46,7 @@ make_default() { * */ void AlphaTestAttrib:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type() << ":"; output_comparefunc(out,_mode); out << "," << _reference_alpha; diff --git a/panda/src/pgraph/antialiasAttrib.cxx b/panda/src/pgraph/antialiasAttrib.cxx index ef35490753..260b4fdef1 100644 --- a/panda/src/pgraph/antialiasAttrib.cxx +++ b/panda/src/pgraph/antialiasAttrib.cxx @@ -69,7 +69,7 @@ make_default() { * */ void AntialiasAttrib:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type() << ":"; int type = get_mode_type(); diff --git a/panda/src/pgraph/attribNodeRegistry.cxx b/panda/src/pgraph/attribNodeRegistry.cxx index 995fe2b63c..721feb5572 100644 --- a/panda/src/pgraph/attribNodeRegistry.cxx +++ b/panda/src/pgraph/attribNodeRegistry.cxx @@ -41,7 +41,7 @@ add_node(const NodePath &attrib_node) { nassertv(!attrib_node.is_empty()); LightMutexHolder holder(_lock); - pair result = _entries.insert(Entry(attrib_node)); + std::pair result = _entries.insert(Entry(attrib_node)); if (!result.second) { // Replace an existing node. (*result.first)._node = attrib_node; @@ -119,10 +119,10 @@ get_node_type(int n) const { * be the node name as it was at the time the node was recorded; if the node * has changed names since then, this will still return the original name. */ -string AttribNodeRegistry:: +std::string AttribNodeRegistry:: get_node_name(int n) const { LightMutexHolder holder(_lock); - nassertr(n >= 0 && n < (int)_entries.size(), string()); + nassertr(n >= 0 && n < (int)_entries.size(), std::string()); return _entries[n]._name; } @@ -148,7 +148,7 @@ find_node(const NodePath &attrib_node) const { * the registry, or -1 if there is no such node in the registry. */ int AttribNodeRegistry:: -find_node(TypeHandle type, const string &name) const { +find_node(TypeHandle type, const std::string &name) const { LightMutexHolder holder(_lock); Entries::const_iterator ei = _entries.find(Entry(type, name)); if (ei != _entries.end()) { @@ -180,7 +180,7 @@ clear() { * */ void AttribNodeRegistry:: -output(ostream &out) const { +output(std::ostream &out) const { LightMutexHolder holder(_lock); typedef pmap Counts; @@ -211,7 +211,7 @@ output(ostream &out) const { * */ void AttribNodeRegistry:: -write(ostream &out) const { +write(std::ostream &out) const { LightMutexHolder holder(_lock); Entries::const_iterator ei; diff --git a/panda/src/pgraph/audioVolumeAttrib.cxx b/panda/src/pgraph/audioVolumeAttrib.cxx index 52d12156d0..23c6a4d7d8 100644 --- a/panda/src/pgraph/audioVolumeAttrib.cxx +++ b/panda/src/pgraph/audioVolumeAttrib.cxx @@ -99,7 +99,7 @@ set_volume(PN_stdfloat volume) const { * */ void AudioVolumeAttrib:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type() << ":"; if (is_off()) { out << "off"; diff --git a/panda/src/pgraph/auxBitplaneAttrib.cxx b/panda/src/pgraph/auxBitplaneAttrib.cxx index 662ae36b19..16f87b03f2 100644 --- a/panda/src/pgraph/auxBitplaneAttrib.cxx +++ b/panda/src/pgraph/auxBitplaneAttrib.cxx @@ -57,7 +57,7 @@ make_default() { * */ void AuxBitplaneAttrib:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type() << "(" << _outputs << ")"; } diff --git a/panda/src/pgraph/auxSceneData.cxx b/panda/src/pgraph/auxSceneData.cxx index b0a50cb1c0..2ef626c270 100644 --- a/panda/src/pgraph/auxSceneData.cxx +++ b/panda/src/pgraph/auxSceneData.cxx @@ -20,7 +20,7 @@ TypeHandle AuxSceneData::_type_handle; * */ void AuxSceneData:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type() << " expires " << get_expiration_time(); } @@ -28,6 +28,6 @@ output(ostream &out) const { * */ void AuxSceneData:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << *this << "\n"; } diff --git a/panda/src/pgraph/bamFile.cxx b/panda/src/pgraph/bamFile.cxx index fa8ae7f4c0..5bf0d5af88 100644 --- a/panda/src/pgraph/bamFile.cxx +++ b/panda/src/pgraph/bamFile.cxx @@ -24,6 +24,8 @@ #include "virtualFileSystem.h" #include "dcast.h" +using std::string; + /** * */ @@ -61,7 +63,7 @@ open_read(const Filename &bam_filename, bool report_errors) { * for information purposes only. Returns true if successful, false on error. */ bool BamFile:: -open_read(istream &in, const string &bam_filename, bool report_errors) { +open_read(std::istream &in, const string &bam_filename, bool report_errors) { close(); if (!_din.open(in)) { @@ -205,7 +207,7 @@ open_write(const Filename &bam_filename, bool report_errors) { * for information purposes only. Returns true if successful, false on error. */ bool BamFile:: -open_write(ostream &out, const string &bam_filename, bool report_errors) { +open_write(std::ostream &out, const string &bam_filename, bool report_errors) { close(); if (!_dout.open(out)) { diff --git a/panda/src/pgraph/billboardEffect.cxx b/panda/src/pgraph/billboardEffect.cxx index 737b370c42..c5843bb667 100644 --- a/panda/src/pgraph/billboardEffect.cxx +++ b/panda/src/pgraph/billboardEffect.cxx @@ -66,7 +66,7 @@ prepare_flatten_transform(const TransformState *net_transform) const { * */ void BillboardEffect:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type() << ":"; if (is_off()) { out << "(off)"; diff --git a/panda/src/pgraph/cacheStats.cxx b/panda/src/pgraph/cacheStats.cxx index e16c14801e..4721171e86 100644 --- a/panda/src/pgraph/cacheStats.cxx +++ b/panda/src/pgraph/cacheStats.cxx @@ -49,7 +49,7 @@ reset(double now) { * */ void CacheStats:: -write(ostream &out, const char *name) const { +write(std::ostream &out, const char *name) const { #ifndef NDEBUG out << name << " cache: " << _cache_hits << " hits, " << _cache_misses << " misses\n" diff --git a/panda/src/pgraph/camera.cxx b/panda/src/pgraph/camera.cxx index 4ab1039d05..5a10d6145e 100644 --- a/panda/src/pgraph/camera.cxx +++ b/panda/src/pgraph/camera.cxx @@ -16,6 +16,8 @@ #include "lens.h" #include "throw_event.h" +using std::string; + TypeHandle Camera::_type_handle; /** @@ -195,7 +197,7 @@ get_aux_scene_data(const NodePath &node_path) const { * Outputs all of the NodePaths and AuxSceneDatas in use. */ void Camera:: -list_aux_scene_data(ostream &out) const { +list_aux_scene_data(std::ostream &out) const { out << _aux_data.size() << " data objects held:\n"; AuxData::const_iterator ai; for (ai = _aux_data.begin(); ai != _aux_data.end(); ++ai) { diff --git a/panda/src/pgraph/clipPlaneAttrib.cxx b/panda/src/pgraph/clipPlaneAttrib.cxx index f833d2dd94..de3f1183c9 100644 --- a/panda/src/pgraph/clipPlaneAttrib.cxx +++ b/panda/src/pgraph/clipPlaneAttrib.cxx @@ -375,7 +375,7 @@ add_on_plane(const NodePath &plane) const { attrib->_on_planes.insert(plane); attrib->_off_planes.erase(plane); - pair insert_result = + std::pair insert_result = attrib->_on_planes.insert(Planes::value_type(plane)); if (insert_result.second) { // Also ensure it is removed from the off_planes list. @@ -552,7 +552,7 @@ compose_off(const RenderAttrib *other) const { * */ void ClipPlaneAttrib:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type() << ":"; if (_off_planes.empty()) { if (_on_planes.empty()) { diff --git a/panda/src/pgraph/colorAttrib.cxx b/panda/src/pgraph/colorAttrib.cxx index 5af6ace015..7bfbecee79 100644 --- a/panda/src/pgraph/colorAttrib.cxx +++ b/panda/src/pgraph/colorAttrib.cxx @@ -75,7 +75,7 @@ make_default() { * */ void ColorAttrib:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type() << ":"; switch (get_color_type()) { case T_vertex: diff --git a/panda/src/pgraph/colorBlendAttrib.cxx b/panda/src/pgraph/colorBlendAttrib.cxx index 9341f2d808..f9a24d96bf 100644 --- a/panda/src/pgraph/colorBlendAttrib.cxx +++ b/panda/src/pgraph/colorBlendAttrib.cxx @@ -19,6 +19,8 @@ #include "datagram.h" #include "datagramIterator.h" +using std::ostream; + TypeHandle ColorBlendAttrib::_type_handle; int ColorBlendAttrib::_attrib_slot; diff --git a/panda/src/pgraph/colorScaleAttrib.cxx b/panda/src/pgraph/colorScaleAttrib.cxx index 572f3e0e14..088c3142ef 100644 --- a/panda/src/pgraph/colorScaleAttrib.cxx +++ b/panda/src/pgraph/colorScaleAttrib.cxx @@ -129,7 +129,7 @@ lower_attrib_can_override() const { * */ void ColorScaleAttrib:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type() << ":"; if (is_off()) { out << "off"; diff --git a/panda/src/pgraph/colorWriteAttrib.cxx b/panda/src/pgraph/colorWriteAttrib.cxx index 98c889a0de..671fa82629 100644 --- a/panda/src/pgraph/colorWriteAttrib.cxx +++ b/panda/src/pgraph/colorWriteAttrib.cxx @@ -44,7 +44,7 @@ make_default() { * */ void ColorWriteAttrib:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type() << ":"; if (_channels == 0) { out << "off"; diff --git a/panda/src/pgraph/compassEffect.cxx b/panda/src/pgraph/compassEffect.cxx index d972e7f45a..41bd9af880 100644 --- a/panda/src/pgraph/compassEffect.cxx +++ b/panda/src/pgraph/compassEffect.cxx @@ -50,7 +50,7 @@ safe_to_transform() const { * */ void CompassEffect:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type() << ":"; if (_properties == 0) { out << " none"; diff --git a/panda/src/pgraph/cullBinAttrib.cxx b/panda/src/pgraph/cullBinAttrib.cxx index f8eb40626d..27238c9c31 100644 --- a/panda/src/pgraph/cullBinAttrib.cxx +++ b/panda/src/pgraph/cullBinAttrib.cxx @@ -28,7 +28,7 @@ int CullBinAttrib::_attrib_slot; * only to certain kinds of bins (in particular CullBinFixed type bins). */ CPT(RenderAttrib) CullBinAttrib:: -make(const string &bin_name, int draw_order) { +make(const std::string &bin_name, int draw_order) { CullBinAttrib *attrib = new CullBinAttrib; attrib->_bin_name = bin_name; attrib->_draw_order = draw_order; @@ -48,7 +48,7 @@ make_default() { * */ void CullBinAttrib:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type() << ":"; if (_bin_name.empty()) { out << "(default)"; diff --git a/panda/src/pgraph/cullBinManager.cxx b/panda/src/pgraph/cullBinManager.cxx index 56aed8c730..5826905c89 100644 --- a/panda/src/pgraph/cullBinManager.cxx +++ b/panda/src/pgraph/cullBinManager.cxx @@ -18,6 +18,8 @@ #include "string_utils.h" #include "configVariableColor.h" +using std::string; + CullBinManager *CullBinManager::_global_ptr = nullptr; /** @@ -165,7 +167,7 @@ find_bin(const string &name) const { * */ void CullBinManager:: -write(ostream &out) const { +write(std::ostream &out) const { if (!_bins_are_sorted) { ((CullBinManager *)this)->do_sort_bins(); } @@ -316,8 +318,8 @@ parse_bin_type(const string &bin_type) { /** * */ -ostream & -operator << (ostream &out, CullBinManager::BinType bin_type) { +std::ostream & +operator << (std::ostream &out, CullBinManager::BinType bin_type) { switch (bin_type) { case CullBinManager::BT_invalid: return out << "invalid"; diff --git a/panda/src/pgraph/cullFaceAttrib.cxx b/panda/src/pgraph/cullFaceAttrib.cxx index db3527a653..054d8061b3 100644 --- a/panda/src/pgraph/cullFaceAttrib.cxx +++ b/panda/src/pgraph/cullFaceAttrib.cxx @@ -99,7 +99,7 @@ get_effective_mode() const { * */ void CullFaceAttrib:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type() << ":"; switch (get_actual_mode()) { case M_cull_none: diff --git a/panda/src/pgraph/cullPlanes.cxx b/panda/src/pgraph/cullPlanes.cxx index fcb7a0c532..fafbae6cfa 100644 --- a/panda/src/pgraph/cullPlanes.cxx +++ b/panda/src/pgraph/cullPlanes.cxx @@ -18,6 +18,9 @@ #include "occluderEffect.h" #include "boundingBox.h" +using std::max; +using std::min; + /** * Returns a pointer to an empty CullPlanes object. */ @@ -200,8 +203,8 @@ apply_state(const CullTraverser *trav, const CullTraverserData *data, if (plane.get_normal().dot(LVector3::forward()) >= 0.0) { if (occluder_node->is_double_sided()) { - swap(points_near[0], points_near[3]); - swap(points_near[1], points_near[2]); + std::swap(points_near[0], points_near[3]); + std::swap(points_near[1], points_near[2]); plane = LPlane(points_near[0], points_near[1], points_near[2]); } else { // This occluder is facing the wrong direction. Ignore it. @@ -429,7 +432,7 @@ remove_occluder(const NodePath &occluder) const { * */ void CullPlanes:: -write(ostream &out) const { +write(std::ostream &out) const { out << "CullPlanes (" << _planes.size() << " planes and " << _occluders.size() << " occluders):\n"; Planes::const_iterator pi; diff --git a/panda/src/pgraph/cullResult.cxx b/panda/src/pgraph/cullResult.cxx index 8f3e8dc19a..faee06ee53 100644 --- a/panda/src/pgraph/cullResult.cxx +++ b/panda/src/pgraph/cullResult.cxx @@ -359,7 +359,7 @@ make_new_bin(int bin_index) { nassertr(bin_index >= 0 && bin_index < (int)_bins.size(), nullptr); // Prevent unnecessary refunref by swapping the PointerTos. - swap(_bins[bin_index], bin); + std::swap(_bins[bin_index], bin); } return bin_ptr; diff --git a/panda/src/pgraph/cullTraverser.cxx b/panda/src/pgraph/cullTraverser.cxx index 50726c2ee7..0ecf27666a 100644 --- a/panda/src/pgraph/cullTraverser.cxx +++ b/panda/src/pgraph/cullTraverser.cxx @@ -237,7 +237,7 @@ draw_bounding_volume(const BoundingVolume *vol, _cull_handler->record_object(outer_viz, this); CullableObject *inner_viz = - new CullableObject(move(bounds_viz), get_bounds_inner_viz_state(), + new CullableObject(std::move(bounds_viz), get_bounds_inner_viz_state(), internal_transform); _cull_handler->record_object(inner_viz, this); } @@ -267,7 +267,7 @@ show_bounds(CullTraverserData &data, bool tight) { if (bounds_viz != nullptr) { _geoms_pcollector.add_level(1); CullableObject *outer_viz = - new CullableObject(move(bounds_viz), get_bounds_outer_viz_state(), + new CullableObject(std::move(bounds_viz), get_bounds_outer_viz_state(), internal_transform); _cull_handler->record_object(outer_viz, this); } diff --git a/panda/src/pgraph/cullTraverserData.cxx b/panda/src/pgraph/cullTraverserData.cxx index e0aed703e9..8d54308af8 100644 --- a/panda/src/pgraph/cullTraverserData.cxx +++ b/panda/src/pgraph/cullTraverserData.cxx @@ -41,7 +41,7 @@ apply_transform_and_state(CullTraverser *trav) { // camera. This indicates some special state transition for this node, // which is unique to this camera. const Camera *camera = trav->get_scene()->get_camera_node(); - string tag_state = _node_reader.get_tag(trav->get_tag_state_key()); + std::string tag_state = _node_reader.get_tag(trav->get_tag_state_key()); node_state = node_state->compose(camera->get_tag_state(tag_state)); } _node_reader.compose_draw_mask(_draw_mask); @@ -154,7 +154,7 @@ is_in_view_impl() { if (pgraph_cat.is_spam()) { pgraph_cat.spam() - << get_node_path() << " cull result = " << hex << result << dec << "\n"; + << get_node_path() << " cull result = " << std::hex << result << std::dec << "\n"; } if (result == BoundingVolume::IF_no_intersection) { @@ -202,8 +202,8 @@ is_in_view_impl() { if (pgraph_cat.is_spam()) { pgraph_cat.spam() - << get_node_path() << " cull planes cull result = " << hex - << result << dec << "\n"; + << get_node_path() << " cull planes cull result = " << std::hex + << result << std::dec << "\n"; _cull_planes->write(pgraph_cat.spam(false)); } diff --git a/panda/src/pgraph/cullableObject.cxx b/panda/src/pgraph/cullableObject.cxx index 3e6db8453c..dae73b00ed 100644 --- a/panda/src/pgraph/cullableObject.cxx +++ b/panda/src/pgraph/cullableObject.cxx @@ -114,8 +114,8 @@ munge_geom(GraphicsStateGuardianBase *gsg, GeomMunger *munger, if (pgraph_cat.is_spam()) { pgraph_cat.spam() << "munge_points_to_quads() for geometry with bits: " - << hex << geom_rendering << ", unsupported: " - << (unsupported_bits & Geom::GR_point_bits) << dec << "\n"; + << std::hex << geom_rendering << ", unsupported: " + << (unsupported_bits & Geom::GR_point_bits) << std::dec << "\n"; } if (!munge_points_to_quads(traverser, force)) { return false; @@ -161,7 +161,7 @@ munge_geom(GraphicsStateGuardianBase *gsg, GeomMunger *munger, _munged_data->animate_vertices(force, current_thread); if (animated_vertices != _munged_data) { cpu_animated = true; - swap(_munged_data, animated_vertices); + std::swap(_munged_data, animated_vertices); } #ifndef NDEBUG @@ -187,7 +187,7 @@ munge_geom(GraphicsStateGuardianBase *gsg, GeomMunger *munger, * */ void CullableObject:: -output(ostream &out) const { +output(std::ostream &out) const { if (_geom != nullptr) { out << *_geom; } else { @@ -583,7 +583,7 @@ munge_points_to_quads(const CullTraverser *traverser, bool force) { } _geom = new_geom.p(); - _munged_data = move(new_data); + _munged_data = std::move(new_data); return true; } diff --git a/panda/src/pgraph/depthOffsetAttrib.cxx b/panda/src/pgraph/depthOffsetAttrib.cxx index a04e72bffb..5516dd52ff 100644 --- a/panda/src/pgraph/depthOffsetAttrib.cxx +++ b/panda/src/pgraph/depthOffsetAttrib.cxx @@ -60,7 +60,7 @@ make_default() { * */ void DepthOffsetAttrib:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type() << ":(" << get_offset() << ", " << get_min_value() << ", " << get_max_value() << ")"; } diff --git a/panda/src/pgraph/depthTestAttrib.cxx b/panda/src/pgraph/depthTestAttrib.cxx index b75f63b436..eb4093b168 100644 --- a/panda/src/pgraph/depthTestAttrib.cxx +++ b/panda/src/pgraph/depthTestAttrib.cxx @@ -44,7 +44,7 @@ make_default() { * */ void DepthTestAttrib:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type() << ":"; output_comparefunc(out,_mode); } diff --git a/panda/src/pgraph/depthWriteAttrib.cxx b/panda/src/pgraph/depthWriteAttrib.cxx index eef6264d47..b12d0c30b8 100644 --- a/panda/src/pgraph/depthWriteAttrib.cxx +++ b/panda/src/pgraph/depthWriteAttrib.cxx @@ -44,7 +44,7 @@ make_default() { * */ void DepthWriteAttrib:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type() << ":"; switch (get_mode()) { case M_off: diff --git a/panda/src/pgraph/findApproxLevelEntry.cxx b/panda/src/pgraph/findApproxLevelEntry.cxx index 2ea72cd889..07c8f1f931 100644 --- a/panda/src/pgraph/findApproxLevelEntry.cxx +++ b/panda/src/pgraph/findApproxLevelEntry.cxx @@ -22,7 +22,7 @@ TypeHandle FindApproxLevelEntry::_type_handle; * Formats the entry for meaningful output. For debugging only. */ void FindApproxLevelEntry:: -output(ostream &out) const { +output(std::ostream &out) const { out << "(" << _node_path << "):"; if (is_solution(0)) { out << " solution!"; @@ -38,7 +38,7 @@ output(ostream &out) const { * For debugging only. */ void FindApproxLevelEntry:: -write_level(ostream &out, int indent_level) const { +write_level(std::ostream &out, int indent_level) const { for (const FindApproxLevelEntry *entry = this; entry != nullptr; entry = entry->_next) { diff --git a/panda/src/pgraph/findApproxPath.cxx b/panda/src/pgraph/findApproxPath.cxx index 0b8d035580..093a160f32 100644 --- a/panda/src/pgraph/findApproxPath.cxx +++ b/panda/src/pgraph/findApproxPath.cxx @@ -17,6 +17,9 @@ #include "string_utils.h" #include "pandaNode.h" +using std::ostream; +using std::string; + /** * Returns true if the indicated node matches this component, false otherwise. diff --git a/panda/src/pgraph/fog.cxx b/panda/src/pgraph/fog.cxx index 654c6fd613..dc45af63ee 100644 --- a/panda/src/pgraph/fog.cxx +++ b/panda/src/pgraph/fog.cxx @@ -27,8 +27,8 @@ TypeHandle Fog::_type_handle; -ostream & -operator << (ostream &out, Fog::Mode mode) { +std::ostream & +operator << (std::ostream &out, Fog::Mode mode) { switch (mode) { case Fog::M_linear: return out << "linear"; @@ -47,7 +47,7 @@ operator << (ostream &out, Fog::Mode mode) { * */ Fog:: -Fog(const string &name) : +Fog(const std::string &name) : PandaNode(name) { _mode = M_linear; @@ -112,7 +112,7 @@ xform(const LMatrix4 &mat) { * */ void Fog:: -output(ostream &out) const { +output(std::ostream &out) const { out << "fog: " << _mode; switch (_mode) { case M_linear: diff --git a/panda/src/pgraph/fogAttrib.cxx b/panda/src/pgraph/fogAttrib.cxx index 17016cd7b0..3a511f7d19 100644 --- a/panda/src/pgraph/fogAttrib.cxx +++ b/panda/src/pgraph/fogAttrib.cxx @@ -54,7 +54,7 @@ make_off() { * */ void FogAttrib:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type() << ":"; if (is_off()) { out << "(off)"; diff --git a/panda/src/pgraph/geomDrawCallbackData.cxx b/panda/src/pgraph/geomDrawCallbackData.cxx index 1b6dc76082..b8bdae2d78 100644 --- a/panda/src/pgraph/geomDrawCallbackData.cxx +++ b/panda/src/pgraph/geomDrawCallbackData.cxx @@ -21,7 +21,7 @@ TypeHandle GeomDrawCallbackData::_type_handle; * */ void GeomDrawCallbackData:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type() << "(" << (void *)_obj << ", " << (void *)_gsg << ", " << _force << ")"; } diff --git a/panda/src/pgraph/geomNode.cxx b/panda/src/pgraph/geomNode.cxx index cbbb7bb609..328870364a 100644 --- a/panda/src/pgraph/geomNode.cxx +++ b/panda/src/pgraph/geomNode.cxx @@ -51,7 +51,7 @@ TypeHandle GeomNode::_type_handle; * */ GeomNode:: -GeomNode(const string &name) : +GeomNode(const std::string &name) : PandaNode(name) { _preserved = preserve_geom_nodes; @@ -559,7 +559,7 @@ add_for_draw(CullTraverser *trav, CullTraverserData &data) { } CullableObject *object = - new CullableObject(move(geom), move(state), internal_transform); + new CullableObject(std::move(geom), std::move(state), internal_transform); trav->get_cull_handler()->record_object(object, trav); } } @@ -782,7 +782,7 @@ unify(int max_indices, bool preserve_order) { * Writes a short description of all the Geoms in the node. */ void GeomNode:: -write_geoms(ostream &out, int indent_level) const { +write_geoms(std::ostream &out, int indent_level) const { CDReader cdata(_cycler); write(out, indent_level); GeomList::const_iterator gi; @@ -798,7 +798,7 @@ write_geoms(ostream &out, int indent_level) const { * Writes a detailed description of all the Geoms in the node. */ void GeomNode:: -write_verbose(ostream &out, int indent_level) const { +write_verbose(std::ostream &out, int indent_level) const { CDReader cdata(_cycler); write(out, indent_level); GeomList::const_iterator gi; @@ -816,7 +816,7 @@ write_verbose(ostream &out, int indent_level) const { * */ void GeomNode:: -output(ostream &out) const { +output(std::ostream &out) const { // Accumulate the total set of RenderAttrib types that are applied to any of // our Geoms, so we can output them too. The result will be the list of // attrib types that might be applied to some Geoms, but not necessarily to diff --git a/panda/src/pgraph/geomTransformer.cxx b/panda/src/pgraph/geomTransformer.cxx index e21327b304..6e4d30955e 100644 --- a/panda/src/pgraph/geomTransformer.cxx +++ b/panda/src/pgraph/geomTransformer.cxx @@ -151,7 +151,7 @@ transform_vertices(GeomNode *node, const LMatrix4 &mat) { GeomNode::GeomEntry &entry = (*gi); PT(Geom) new_geom = entry._geom.get_read_pointer()->make_copy(); if (transform_vertices(new_geom, mat)) { - entry._geom = move(new_geom); + entry._geom = std::move(new_geom); any_changed = true; } } diff --git a/panda/src/pgraph/internalNameCollection.cxx b/panda/src/pgraph/internalNameCollection.cxx index 93b92e3518..9c3779c88e 100644 --- a/panda/src/pgraph/internalNameCollection.cxx +++ b/panda/src/pgraph/internalNameCollection.cxx @@ -211,7 +211,7 @@ size() const { * indicated output stream. */ void InternalNameCollection:: -output(ostream &out) const { +output(std::ostream &out) const { if (get_num_names() == 1) { out << "1 InternalName"; } else { @@ -224,7 +224,7 @@ output(ostream &out) const { * the indicated output stream. */ void InternalNameCollection:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { for (int i = 0; i < get_num_names(); i++) { indent(out, indent_level) << *get_name(i) << "\n"; } diff --git a/panda/src/pgraph/lensNode.cxx b/panda/src/pgraph/lensNode.cxx index 60307c2ce0..1b428d9e98 100644 --- a/panda/src/pgraph/lensNode.cxx +++ b/panda/src/pgraph/lensNode.cxx @@ -26,7 +26,7 @@ TypeHandle LensNode::_type_handle; * */ LensNode:: -LensNode(const string &name, Lens *lens) : +LensNode(const std::string &name, Lens *lens) : PandaNode(name) { if (lens == nullptr) { @@ -171,7 +171,7 @@ hide_frustum() { * */ void LensNode:: -output(ostream &out) const { +output(std::ostream &out) const { PandaNode::output(out); out << " ("; @@ -190,7 +190,7 @@ output(ostream &out) const { * */ void LensNode:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { PandaNode::write(out, indent_level); for (Lenses::const_iterator li = _lenses.begin(); diff --git a/panda/src/pgraph/lightAttrib.cxx b/panda/src/pgraph/lightAttrib.cxx index 1ad177b1b4..1d6fce8cf7 100644 --- a/panda/src/pgraph/lightAttrib.cxx +++ b/panda/src/pgraph/lightAttrib.cxx @@ -420,7 +420,7 @@ add_on_light(const NodePath &light) const { LightAttrib *attrib = new LightAttrib(*this); - pair insert_result = + std::pair insert_result = attrib->_on_lights.insert(Lights::value_type(light)); if (insert_result.second) { lobj->attrib_ref(); @@ -523,7 +523,7 @@ get_ambient_contribution() const { * */ void LightAttrib:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type() << ":"; if (_off_lights.empty()) { if (_on_lights.empty()) { @@ -572,7 +572,7 @@ output(ostream &out) const { * */ void LightAttrib:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << get_type() << ":"; if (_off_lights.empty()) { if (_on_lights.empty()) { diff --git a/panda/src/pgraph/lightRampAttrib.cxx b/panda/src/pgraph/lightRampAttrib.cxx index 93adfc305b..3f5caee8d9 100644 --- a/panda/src/pgraph/lightRampAttrib.cxx +++ b/panda/src/pgraph/lightRampAttrib.cxx @@ -176,7 +176,7 @@ make_hdr2() { * */ void LightRampAttrib:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type() << ":"; switch (_mode) { case LRT_default: diff --git a/panda/src/pgraph/loader.cxx b/panda/src/pgraph/loader.cxx index 866f3c2f14..03ae0e0587 100644 --- a/panda/src/pgraph/loader.cxx +++ b/panda/src/pgraph/loader.cxx @@ -32,6 +32,8 @@ #include "configVariableInt.h" #include "configVariableEnum.h" +using std::string; + bool Loader::_file_types_loaded = false; PT(Loader) Loader::_global_ptr; TypeHandle Loader::_type_handle; @@ -96,7 +98,7 @@ make_async_save_request(const Filename &filename, const LoaderOptions &options, * graph defined there. */ PT(PandaNode) Loader:: -load_bam_stream(istream &in) { +load_bam_stream(std::istream &in) { BamFile bam_file; if (!bam_file.open_read(in)) { return nullptr; @@ -109,7 +111,7 @@ load_bam_stream(istream &in) { * */ void Loader:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type() << " " << get_name(); int num_tasks = _task_manager->make_task_chain(_task_chain)->get_num_tasks(); @@ -473,15 +475,15 @@ load_file_types() { string name = words[0]; Filename dlname = Filename::dso_filename("lib" + name + ".so"); loader_cat.info() - << "loading file type module: " << name << endl; + << "loading file type module: " << name << std::endl; void *tmp = load_dso(get_plugin_path().get_value(), dlname); if (tmp == nullptr) { loader_cat.warning() << "Unable to load " << dlname.to_os_specific() - << ": " << load_dso_error() << endl; + << ": " << load_dso_error() << std::endl; } else if (loader_cat.is_debug()) { loader_cat.debug() - << "done loading file type module: " << name << endl; + << "done loading file type module: " << name << std::endl; } } else if (words.size() > 1) { diff --git a/panda/src/pgraph/loaderFileType.cxx b/panda/src/pgraph/loaderFileType.cxx index a7189526ed..262da5859f 100644 --- a/panda/src/pgraph/loaderFileType.cxx +++ b/panda/src/pgraph/loaderFileType.cxx @@ -41,9 +41,9 @@ LoaderFileType:: * Returns a space-separated list of extension, in addition to the one * returned by get_extension(), that are recognized by this loader. */ -string LoaderFileType:: +std::string LoaderFileType:: get_additional_extensions() const { - return string(); + return std::string(); } /** diff --git a/panda/src/pgraph/loaderFileTypeBam.cxx b/panda/src/pgraph/loaderFileTypeBam.cxx index 985ffb706a..7d2f6fd2cd 100644 --- a/panda/src/pgraph/loaderFileTypeBam.cxx +++ b/panda/src/pgraph/loaderFileTypeBam.cxx @@ -32,7 +32,7 @@ LoaderFileTypeBam() { /** * */ -string LoaderFileTypeBam:: +std::string LoaderFileTypeBam:: get_name() const { return "Bam"; } @@ -40,7 +40,7 @@ get_name() const { /** * */ -string LoaderFileTypeBam:: +std::string LoaderFileTypeBam:: get_extension() const { return "bam"; } diff --git a/panda/src/pgraph/loaderFileTypeRegistry.cxx b/panda/src/pgraph/loaderFileTypeRegistry.cxx index 6f5f6fed44..c7df6731eb 100644 --- a/panda/src/pgraph/loaderFileTypeRegistry.cxx +++ b/panda/src/pgraph/loaderFileTypeRegistry.cxx @@ -21,6 +21,8 @@ #include +using std::string; + LoaderFileTypeRegistry *LoaderFileTypeRegistry::_global_ptr; /** @@ -152,16 +154,16 @@ get_type_from_extension(const string &extension) { _deferred_types.erase(di); loader_cat->info() - << "loading file type module: " << name << endl; + << "loading file type module: " << name << std::endl; void *tmp = load_dso(get_plugin_path().get_value(), dlname); if (tmp == nullptr) { loader_cat->warning() << "Unable to load " << dlname.to_os_specific() << ": " - << load_dso_error() << endl; + << load_dso_error() << std::endl; return nullptr; } else if (loader_cat.is_debug()) { loader_cat.debug() - << "done loading file type module: " << name << endl; + << "done loading file type module: " << name << std::endl; } // Now try again to find the LoaderFileType. @@ -183,7 +185,7 @@ get_type_from_extension(const string &extension) { * per line. */ void LoaderFileTypeRegistry:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { if (_types.empty()) { indent(out, indent_level) << "(No file types are known).\n"; } else { @@ -192,7 +194,7 @@ write(ostream &out, int indent_level) const { LoaderFileType *type = (*ti); string name = type->get_name(); indent(out, indent_level) << name; - indent(out, max(30 - (int)name.length(), 0)) << " "; + indent(out, std::max(30 - (int)name.length(), 0)) << " "; bool comma = false; if (!type->get_extension().empty()) { diff --git a/panda/src/pgraph/logicOpAttrib.cxx b/panda/src/pgraph/logicOpAttrib.cxx index 28381dfc5b..75aff15fce 100644 --- a/panda/src/pgraph/logicOpAttrib.cxx +++ b/panda/src/pgraph/logicOpAttrib.cxx @@ -53,7 +53,7 @@ make_default() { * */ void LogicOpAttrib:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type() << ":" << get_operation(); } @@ -138,8 +138,8 @@ fillin(DatagramIterator &scan, BamReader *manager) { /** * */ -ostream & -operator << (ostream &out, LogicOpAttrib::Operation op) { +std::ostream & +operator << (std::ostream &out, LogicOpAttrib::Operation op) { switch (op) { case LogicOpAttrib::O_none: return out << "none"; diff --git a/panda/src/pgraph/materialAttrib.cxx b/panda/src/pgraph/materialAttrib.cxx index baeac4dc38..2ff453b8c6 100644 --- a/panda/src/pgraph/materialAttrib.cxx +++ b/panda/src/pgraph/materialAttrib.cxx @@ -56,7 +56,7 @@ make_default() { * */ void MaterialAttrib:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type() << ":"; if (_material != nullptr) { out << *_material; diff --git a/panda/src/pgraph/materialCollection.cxx b/panda/src/pgraph/materialCollection.cxx index 386758f1c5..37fbd79c80 100644 --- a/panda/src/pgraph/materialCollection.cxx +++ b/panda/src/pgraph/materialCollection.cxx @@ -173,7 +173,7 @@ clear() { * NULL if no material has that name. */ Material *MaterialCollection:: -find_material(const string &name) const { +find_material(const std::string &name) const { int num_materials = get_num_materials(); for (int i = 0; i < num_materials; i++) { Material *material = get_material(i); @@ -227,7 +227,7 @@ size() const { * indicated output stream. */ void MaterialCollection:: -output(ostream &out) const { +output(std::ostream &out) const { if (get_num_materials() == 1) { out << "1 Material"; } else { @@ -240,7 +240,7 @@ output(ostream &out) const { * indicated output stream. */ void MaterialCollection:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { for (int i = 0; i < get_num_materials(); i++) { indent(out, indent_level) << *get_material(i) << "\n"; } diff --git a/panda/src/pgraph/modelLoadRequest.cxx b/panda/src/pgraph/modelLoadRequest.cxx index 4feba702ef..0bbec06161 100644 --- a/panda/src/pgraph/modelLoadRequest.cxx +++ b/panda/src/pgraph/modelLoadRequest.cxx @@ -22,7 +22,7 @@ TypeHandle ModelLoadRequest::_type_handle; * to begin an asynchronous load. */ ModelLoadRequest:: -ModelLoadRequest(const string &name, +ModelLoadRequest(const std::string &name, const Filename &filename, const LoaderOptions &options, Loader *loader) : AsyncTask(name), diff --git a/panda/src/pgraph/modelPool.cxx b/panda/src/pgraph/modelPool.cxx index b5722f2271..c53e2b867f 100644 --- a/panda/src/pgraph/modelPool.cxx +++ b/panda/src/pgraph/modelPool.cxx @@ -25,7 +25,7 @@ ModelPool *ModelPool::_global_ptr = nullptr; * with debugging. */ void ModelPool:: -write(ostream &out) { +write(std::ostream &out) { get_ptr()->ns_list_contents(out); } @@ -259,7 +259,7 @@ ns_garbage_collect() { * The nonstatic implementation of list_contents(). */ void ModelPool:: -ns_list_contents(ostream &out) const { +ns_list_contents(std::ostream &out) const { LightMutexHolder holder(_lock); out << "model pool contents:\n"; diff --git a/panda/src/pgraph/modelSaveRequest.cxx b/panda/src/pgraph/modelSaveRequest.cxx index 31c50cfdf6..eefca944d4 100644 --- a/panda/src/pgraph/modelSaveRequest.cxx +++ b/panda/src/pgraph/modelSaveRequest.cxx @@ -22,7 +22,7 @@ TypeHandle ModelSaveRequest::_type_handle; * to begin an asynchronous save. */ ModelSaveRequest:: -ModelSaveRequest(const string &name, +ModelSaveRequest(const std::string &name, const Filename &filename, const LoaderOptions &options, PandaNode *node, Loader *loader) : AsyncTask(name), diff --git a/panda/src/pgraph/nodePath.cxx b/panda/src/pgraph/nodePath.cxx index 065bef7424..9123a951b5 100644 --- a/panda/src/pgraph/nodePath.cxx +++ b/panda/src/pgraph/nodePath.cxx @@ -73,6 +73,12 @@ #include "datagramBuffer.h" #include "weakNodePath.h" +using std::max; +using std::move; +using std::ostream; +using std::ostringstream; +using std::string; + // stack seems to overflow on Intel C++ at 7000. If we need more than 7000, // need to increase stack size. int NodePath::_max_search_depth = 7000; diff --git a/panda/src/pgraph/nodePathCollection.cxx b/panda/src/pgraph/nodePathCollection.cxx index 8f29f07f22..545691d0fc 100644 --- a/panda/src/pgraph/nodePathCollection.cxx +++ b/panda/src/pgraph/nodePathCollection.cxx @@ -19,6 +19,9 @@ #include "colorAttrib.h" #include "indent.h" +using std::max; +using std::min; + /** * Adds a new NodePath to the collection. */ @@ -208,7 +211,7 @@ size() const { * hierarchically. */ void NodePathCollection:: -ls(ostream &out, int indent_level) const { +ls(std::ostream &out, int indent_level) const { for (int i = 0; i < get_num_paths(); i++) { NodePath path = get_path(i); indent(out, indent_level) << path << "\n"; @@ -223,7 +226,7 @@ ls(ostream &out, int indent_level) const { * listed first. */ NodePathCollection NodePathCollection:: -find_all_matches(const string &path) const { +find_all_matches(const std::string &path) const { NodePathCollection result; FindApproxPath approx_path; @@ -557,7 +560,7 @@ set_attrib(const RenderAttrib *attrib, int priority) { * indicated output stream. */ void NodePathCollection:: -output(ostream &out) const { +output(std::ostream &out) const { if (get_num_paths() == 1) { out << "1 NodePath"; } else { @@ -570,7 +573,7 @@ output(ostream &out) const { * indicated output stream. */ void NodePathCollection:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { for (int i = 0; i < get_num_paths(); i++) { indent(out, indent_level) << get_path(i) << "\n"; } diff --git a/panda/src/pgraph/nodePathCollection_ext.cxx b/panda/src/pgraph/nodePathCollection_ext.cxx index 1e2b13fe1e..836e2959e0 100644 --- a/panda/src/pgraph/nodePathCollection_ext.cxx +++ b/panda/src/pgraph/nodePathCollection_ext.cxx @@ -48,9 +48,9 @@ __init__(PyObject *self, PyObject *sequence) { NodePath *path; if (!DtoolInstance_GetPointer(item, path, Dtool_NodePath)) { // Unable to add item--probably it wasn't of the appropriate type. - ostringstream stream; + std::ostringstream stream; stream << "Element " << i << " in sequence passed to NodePathCollection constructor is not a NodePath"; - string str = stream.str(); + std::string str = stream.str(); PyErr_SetString(PyExc_TypeError, str.c_str()); Py_DECREF(fast); return; diff --git a/panda/src/pgraph/nodePathComponent.cxx b/panda/src/pgraph/nodePathComponent.cxx index dd767cf172..fa578ba53f 100644 --- a/panda/src/pgraph/nodePathComponent.cxx +++ b/panda/src/pgraph/nodePathComponent.cxx @@ -121,7 +121,7 @@ fix_length(int pipeline_stage, Thread *current_thread) { * the end of the linked list and then outputting from there. */ void NodePathComponent:: -output(ostream &out) const { +output(std::ostream &out) const { Thread *current_thread = Thread::get_current_thread(); int pipeline_stage = current_thread->get_pipeline_stage(); diff --git a/panda/src/pgraph/nodePath_ext.cxx b/panda/src/pgraph/nodePath_ext.cxx index f167d0c57a..4be58f3201 100644 --- a/panda/src/pgraph/nodePath_ext.cxx +++ b/panda/src/pgraph/nodePath_ext.cxx @@ -16,6 +16,8 @@ #include "shaderInput_ext.h" #include "shaderAttrib.h" +using std::move; + #ifdef HAVE_PYTHON #ifndef CPPPARSER @@ -123,9 +125,9 @@ __reduce_persist__(PyObject *self, PyObject *pickler) const { vector_uchar bam_stream; if (!_this->encode_to_bam_stream(bam_stream, writer)) { - ostringstream stream; + std::ostringstream stream; stream << "Could not bamify " << _this; - string message = stream.str(); + std::string message = stream.str(); PyErr_SetString(PyExc_TypeError, message.c_str()); return nullptr; } @@ -294,7 +296,7 @@ set_shader_inputs(PyObject *args, PyObject *kwargs) { return; } - CPT_InternalName name(string(buffer, length)); + CPT_InternalName name(std::string(buffer, length)); ShaderInput &input = attrib->_inputs[name]; invoke_extension(&input).__init__(move(name), value); } diff --git a/panda/src/pgraph/occluderEffect.cxx b/panda/src/pgraph/occluderEffect.cxx index 9e81d4e52d..eceb1afd6e 100644 --- a/panda/src/pgraph/occluderEffect.cxx +++ b/panda/src/pgraph/occluderEffect.cxx @@ -66,7 +66,7 @@ remove_on_occluder(const NodePath &occluder) const { * */ void OccluderEffect:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type() << ":"; if (_on_occluders.empty()) { out << "identity"; diff --git a/panda/src/pgraph/occluderNode.cxx b/panda/src/pgraph/occluderNode.cxx index 3fc81bc944..09f8bbd038 100644 --- a/panda/src/pgraph/occluderNode.cxx +++ b/panda/src/pgraph/occluderNode.cxx @@ -51,7 +51,7 @@ PT(Texture) OccluderNode::_viz_tex; * vertices with set_vertices(). */ OccluderNode:: -OccluderNode(const string &name) : +OccluderNode(const std::string &name) : PandaNode(name) { set_cull_callback(); @@ -174,7 +174,7 @@ is_renderable() const { * classes to include some information relevant to the class. */ void OccluderNode:: -output(ostream &out) const { +output(std::ostream &out) const { PandaNode::output(out); } diff --git a/panda/src/pgraph/pandaNode.cxx b/panda/src/pgraph/pandaNode.cxx index c6cc323d2a..6994e643f8 100644 --- a/panda/src/pgraph/pandaNode.cxx +++ b/panda/src/pgraph/pandaNode.cxx @@ -28,6 +28,10 @@ #include "lightReMutexHolder.h" #include "graphicsStateGuardianBase.h" +using std::ostream; +using std::ostringstream; +using std::string; + // This category is just temporary for debugging convenience. NotifyCategoryDecl(drawmask, EXPCL_PANDA_PGRAPH, EXPTP_PANDA_PGRAPH); NotifyCategoryDef(drawmask, ""); @@ -2118,7 +2122,7 @@ decode_from_bam_stream(vector_uchar data, BamReader *reader) { TypedWritable *object; ReferenceCount *ref_ptr; - if (TypedWritable::decode_raw_from_bam_stream(object, ref_ptr, move(data), reader)) { + if (TypedWritable::decode_raw_from_bam_stream(object, ref_ptr, std::move(data), reader)) { return DCAST(PandaNode, object); } else { return nullptr; diff --git a/panda/src/pgraph/paramNodePath.cxx b/panda/src/pgraph/paramNodePath.cxx index 32d5aeb585..72a3563b22 100644 --- a/panda/src/pgraph/paramNodePath.cxx +++ b/panda/src/pgraph/paramNodePath.cxx @@ -21,7 +21,7 @@ TypeHandle ParamNodePath::_type_handle; * */ void ParamNodePath:: -output(ostream &out) const { +output(std::ostream &out) const { out << "node path " << _node_path; } diff --git a/panda/src/pgraph/planeNode.cxx b/panda/src/pgraph/planeNode.cxx index 2af7609809..9513b23509 100644 --- a/panda/src/pgraph/planeNode.cxx +++ b/panda/src/pgraph/planeNode.cxx @@ -59,7 +59,7 @@ fillin(DatagramIterator &scan, BamReader *) { * */ PlaneNode:: -PlaneNode(const string &name, const LPlane &plane) : +PlaneNode(const std::string &name, const LPlane &plane) : PandaNode(name), _priority(0), _clip_effect(~0) @@ -88,7 +88,7 @@ PlaneNode(const PlaneNode ©) : * */ void PlaneNode:: -output(ostream &out) const { +output(std::ostream &out) const { PandaNode::output(out); out << " " << get_plane(); } diff --git a/panda/src/pgraph/polylightEffect.cxx b/panda/src/pgraph/polylightEffect.cxx index acbd41b18f..f940a62c8c 100644 --- a/panda/src/pgraph/polylightEffect.cxx +++ b/panda/src/pgraph/polylightEffect.cxx @@ -22,6 +22,8 @@ #include +using std::endl; + TypeHandle PolylightEffect::_type_handle; /** @@ -334,7 +336,7 @@ do_poly_light(const SceneSetup *scene, const CullTraverserData *data, const Tran * */ void PolylightEffect:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type() << ":"; LightGroup::const_iterator li; @@ -461,8 +463,8 @@ has_light(const NodePath &light) const { return (li != _lightgroup.end()); } -ostream & -operator << (ostream &out, PolylightEffect::ContribType ct) { +std::ostream & +operator << (std::ostream &out, PolylightEffect::ContribType ct) { switch (ct) { case PolylightEffect::CT_proximal: return out << "proximal"; diff --git a/panda/src/pgraph/polylightNode.cxx b/panda/src/pgraph/polylightNode.cxx index e7b857367b..73242aab04 100644 --- a/panda/src/pgraph/polylightNode.cxx +++ b/panda/src/pgraph/polylightNode.cxx @@ -29,7 +29,7 @@ TypeHandle PolylightNode::_type_handle; * Use PolylightNode() to construct a new PolylightNode object. */ PolylightNode:: -PolylightNode(const string &name) : +PolylightNode(const std::string &name) : PandaNode(name) { _enabled = true; @@ -100,12 +100,12 @@ LColor PolylightNode::flicker() const { variation = (rand()%100); // a value between 0-99 variation /= 100.0; if (polylight_info) - pgraph_cat.info() << "Random Variation: " << variation << endl; + pgraph_cat.info() << "Random Variation: " << variation << std::endl; } else if (_flicker_type == FSIN) { double now = ClockObject::get_global_clock()->get_frame_time(); variation = sinf(now*_sin_freq); if (polylight_info) - pgraph_cat.info() << "Variation: " << variation << endl; + pgraph_cat.info() << "Variation: " << variation << std::endl; // can't use negative variation, so make it positive if (variation < 0.0) variation *= -1.0; @@ -134,7 +134,7 @@ LColor PolylightNode::flicker() const { b = color[2]; } */ - pgraph_cat.debug() << "Color R:" << r << "; G:" << g << "; B:" << b << endl; + pgraph_cat.debug() << "Color R:" << r << "; G:" << g << "; B:" << b << std::endl; return LColor(r,g,b,1.0); } @@ -277,7 +277,7 @@ fillin(DatagramIterator &scan, BamReader *manager) { * */ void PolylightNode:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type() << ":"; // out << "Position: " << get_x() << " " << get_y() << " " << get_z() << // "\n"; out << "Color: " << get_r() << " " << get_g() << " " << get_b() << diff --git a/panda/src/pgraph/portalClipper.cxx b/panda/src/pgraph/portalClipper.cxx index c0fe73f73f..d9d1af727d 100644 --- a/panda/src/pgraph/portalClipper.cxx +++ b/panda/src/pgraph/portalClipper.cxx @@ -30,6 +30,10 @@ #include "geomLinestrips.h" #include "geomPoints.h" +using std::endl; +using std::max; +using std::min; + TypeHandle PortalClipper::_type_handle; /** diff --git a/panda/src/pgraph/portalNode.cxx b/panda/src/pgraph/portalNode.cxx index 8ddb409f09..c7ad0444fe 100644 --- a/panda/src/pgraph/portalNode.cxx +++ b/panda/src/pgraph/portalNode.cxx @@ -30,6 +30,8 @@ #include "plane.h" +using std::endl; + TypeHandle PortalNode::_type_handle; @@ -39,7 +41,7 @@ TypeHandle PortalNode::_type_handle; * Then you can set the vertices yourself, with addVertex. */ PortalNode:: -PortalNode(const string &name) : +PortalNode(const std::string &name) : PandaNode(name), _from_portal_mask(PortalMask::all_on()), _into_portal_mask(PortalMask::all_on()), @@ -58,7 +60,7 @@ PortalNode(const string &name) : * portal and setup from Python */ PortalNode:: -PortalNode(const string &name, LPoint3 pos, PN_stdfloat scale) : +PortalNode(const std::string &name, LPoint3 pos, PN_stdfloat scale) : PandaNode(name), _from_portal_mask(PortalMask::all_on()), _into_portal_mask(PortalMask::all_on()), @@ -323,7 +325,7 @@ is_renderable() const { * classes to include some information relevant to the class. */ void PortalNode:: -output(ostream &out) const { +output(std::ostream &out) const { PandaNode::output(out); } diff --git a/panda/src/pgraph/renderAttrib.cxx b/panda/src/pgraph/renderAttrib.cxx index 66c507c1c8..73b1e4b392 100644 --- a/panda/src/pgraph/renderAttrib.cxx +++ b/panda/src/pgraph/renderAttrib.cxx @@ -18,6 +18,8 @@ #include "lightReMutexHolder.h" #include "pStatTimer.h" +using std::ostream; + LightReMutex *RenderAttrib::_attribs_lock = nullptr; RenderAttrib::Attribs *RenderAttrib::_attribs = nullptr; TypeHandle RenderAttrib::_type_handle; @@ -198,7 +200,7 @@ garbage_collect() { // How many elements to process this pass? size_t size = orig_size; - size_t num_this_pass = max(0, int(size * garbage_collect_states_rate)); + size_t num_this_pass = std::max(0, int(size * garbage_collect_states_rate)); if (num_this_pass <= 0) { return 0; } @@ -208,7 +210,7 @@ garbage_collect() { si = 0; } - num_this_pass = min(num_this_pass, size); + num_this_pass = std::min(num_this_pass, size); size_t stop_at_element = (_garbage_index + num_this_pass) % size; do { @@ -266,7 +268,7 @@ validate_attribs() { for (size_t si = 0; si < size; ++si) { const RenderAttrib *attrib = _attribs->get_key(si); //cerr << si << ": " << attrib << "\n"; - attrib->write(cerr, 2); + attrib->write(std::cerr, 2); } return false; diff --git a/panda/src/pgraph/renderEffect.cxx b/panda/src/pgraph/renderEffect.cxx index 583c04d812..da052c0073 100644 --- a/panda/src/pgraph/renderEffect.cxx +++ b/panda/src/pgraph/renderEffect.cxx @@ -151,7 +151,7 @@ adjust_transform(CPT(TransformState) &, CPT(TransformState) &, * */ void RenderEffect:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type(); } @@ -159,7 +159,7 @@ output(ostream &out) const { * */ void RenderEffect:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << *this << "\n"; } @@ -181,7 +181,7 @@ get_num_effects() { * prepared. */ void RenderEffect:: -list_effects(ostream &out) { +list_effects(std::ostream &out) { out << _effects->size() << " effects:\n"; Effects::const_iterator si; for (si = _effects->begin(); si != _effects->end(); ++si) { @@ -247,7 +247,7 @@ return_new(RenderEffect *effect) { // of this function if no one else uses it. CPT(RenderEffect) pt_effect = effect; - pair result = _effects->insert(effect); + std::pair result = _effects->insert(effect); if (result.second) { // The effect was inserted; save the iterator and return the input effect. effect->_saved_entry = result.first; diff --git a/panda/src/pgraph/renderEffects.cxx b/panda/src/pgraph/renderEffects.cxx index 4ef038625d..3c1b1066bb 100644 --- a/panda/src/pgraph/renderEffects.cxx +++ b/panda/src/pgraph/renderEffects.cxx @@ -351,7 +351,7 @@ unref() const { * */ void RenderEffects:: -output(ostream &out) const { +output(std::ostream &out) const { out << "E:"; if (_effects.empty()) { out << "(empty)"; @@ -372,7 +372,7 @@ output(ostream &out) const { * */ void RenderEffects:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << _effects.size() << " effects:\n"; Effects::const_iterator ai; for (ai = _effects.begin(); ai != _effects.end(); ++ai) { @@ -400,7 +400,7 @@ get_num_states() { * prepared. */ void RenderEffects:: -list_states(ostream &out) { +list_states(std::ostream &out) { out << _states->size() << " states:\n"; States::const_iterator si; for (si = _states->begin(); si != _states->end(); ++si) { @@ -538,7 +538,7 @@ return_new(RenderEffects *state) { // of this function if no one else uses it. CPT(RenderEffects) pt_state = state; - pair result = _states->insert(state); + std::pair result = _states->insert(state); if (result.second) { // The state was inserted; save the iterator and return the input state. state->_saved_entry = result.first; diff --git a/panda/src/pgraph/renderModeAttrib.cxx b/panda/src/pgraph/renderModeAttrib.cxx index efdf3e7434..1b2b41c9ad 100644 --- a/panda/src/pgraph/renderModeAttrib.cxx +++ b/panda/src/pgraph/renderModeAttrib.cxx @@ -60,7 +60,7 @@ make_default() { * */ void RenderModeAttrib:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type() << ":"; switch (get_mode()) { case M_unchanged: diff --git a/panda/src/pgraph/renderState.cxx b/panda/src/pgraph/renderState.cxx index 1a8a3f0a56..927d1e7073 100644 --- a/panda/src/pgraph/renderState.cxx +++ b/panda/src/pgraph/renderState.cxx @@ -36,6 +36,8 @@ #include "thread.h" #include "renderAttribRegistry.h" +using std::ostream; + LightReMutex *RenderState::_states_lock = nullptr; RenderState::States *RenderState::_states = nullptr; const RenderState *RenderState::_empty_state = nullptr; @@ -590,7 +592,7 @@ adjust_all_priorities(int adjustment) const { while (slot >= 0) { Attribute &attrib = new_state->_attributes[slot]; nassertr(attrib._attrib != nullptr, this); - attrib._override = max(attrib._override + adjustment, 0); + attrib._override = std::max(attrib._override + adjustment, 0); mask.clear_bit(slot); slot = mask.get_lowest_on_bit(); @@ -756,7 +758,7 @@ get_num_unused_states() { const RenderState *result = state->_composition_cache.get_data(i)._result; if (result != nullptr && result != state) { // Here's a RenderState that's recorded in the cache. Count it. - pair ir = + std::pair ir = state_count.insert(StateCount::value_type(result, 1)); if (!ir.second) { // If the above insert operation fails, then it's already in the @@ -769,7 +771,7 @@ get_num_unused_states() { for (i = 0; i < cache_size; ++i) { const RenderState *result = state->_invert_composition_cache.get_data(i)._result; if (result != nullptr && result != state) { - pair ir = + std::pair ir = state_count.insert(StateCount::value_type(result, 1)); if (!ir.second) { (*(ir.first)).second++; @@ -904,7 +906,7 @@ garbage_collect() { // How many elements to process this pass? size_t size = orig_size; - size_t num_this_pass = max(0, int(size * garbage_collect_states_rate)); + size_t num_this_pass = std::max(0, int(size * garbage_collect_states_rate)); if (num_this_pass <= 0) { return num_attribs; } @@ -916,7 +918,7 @@ garbage_collect() { si = 0; } - num_this_pass = min(num_this_pass, size); + num_this_pass = std::min(num_this_pass, size); size_t stop_at_element = (si + num_this_pass) % size; do { @@ -1733,7 +1735,7 @@ determine_bin_index() { return; } - string bin_name; + std::string bin_name; _draw_order = 0; const CullBinAttrib *bin; diff --git a/panda/src/pgraph/rescaleNormalAttrib.cxx b/panda/src/pgraph/rescaleNormalAttrib.cxx index fbc4d59274..0b93da7a23 100644 --- a/panda/src/pgraph/rescaleNormalAttrib.cxx +++ b/panda/src/pgraph/rescaleNormalAttrib.cxx @@ -22,6 +22,10 @@ #include "configVariableEnum.h" #include "config_pgraph.h" +using std::istream; +using std::ostream; +using std::string; + TypeHandle RescaleNormalAttrib::_type_handle; int RescaleNormalAttrib::_attrib_slot; CPT(RenderAttrib) RescaleNormalAttrib::_attribs[RescaleNormalAttrib::M_auto + 1]; diff --git a/panda/src/pgraph/sceneGraphReducer.cxx b/panda/src/pgraph/sceneGraphReducer.cxx index 3b1e075a90..03179d38dd 100644 --- a/panda/src/pgraph/sceneGraphReducer.cxx +++ b/panda/src/pgraph/sceneGraphReducer.cxx @@ -51,7 +51,7 @@ set_gsg(GraphicsStateGuardianBase *gsg) { int max_vertices = max_collect_vertices; if (_gsg != nullptr) { - max_vertices = min(max_vertices, _gsg->get_max_vertices_per_array()); + max_vertices = std::min(max_vertices, _gsg->get_max_vertices_per_array()); } _transformer.set_max_collect_vertices(max_vertices); @@ -181,7 +181,7 @@ unify(PandaNode *root, bool preserve_order) { int max_indices = max_collect_indices; if (_gsg != nullptr) { - max_indices = min(max_indices, _gsg->get_max_vertices_per_primitive()); + max_indices = std::min(max_indices, _gsg->get_max_vertices_per_primitive()); } r_unify(root, max_indices, preserve_order); } @@ -376,7 +376,7 @@ r_flatten(PandaNode *grandparent_node, PandaNode *parent_node, if (pgraph_cat.is_spam()) { pgraph_cat.spam() << "SceneGraphReducer::r_flatten(" << *grandparent_node << ", " - << *parent_node << ", " << hex << combine_siblings_bits << dec + << *parent_node << ", " << std::hex << combine_siblings_bits << std::dec << ")\n"; } @@ -730,7 +730,7 @@ collapse_nodes(PandaNode *node1, PandaNode *node2, bool siblings) { */ void SceneGraphReducer:: choose_name(PandaNode *preserve, PandaNode *source1, PandaNode *source2) { - string name; + std::string name; bool got_name = false; name = source1->get_name(); diff --git a/panda/src/pgraph/scissorAttrib.cxx b/panda/src/pgraph/scissorAttrib.cxx index f6281cd083..4e137eec5b 100644 --- a/panda/src/pgraph/scissorAttrib.cxx +++ b/panda/src/pgraph/scissorAttrib.cxx @@ -19,6 +19,9 @@ #include "datagram.h" #include "datagramIterator.h" +using std::max; +using std::min; + TypeHandle ScissorAttrib::_type_handle; int ScissorAttrib::_attrib_slot; CPT(RenderAttrib) ScissorAttrib::_off_attrib; @@ -78,7 +81,7 @@ make_default() { * */ void ScissorAttrib:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type() << ":[" << _frame << "]"; } diff --git a/panda/src/pgraph/scissorEffect.cxx b/panda/src/pgraph/scissorEffect.cxx index 8e0d47ca9e..dbfa96cf9e 100644 --- a/panda/src/pgraph/scissorEffect.cxx +++ b/panda/src/pgraph/scissorEffect.cxx @@ -23,6 +23,9 @@ #include "boundingHexahedron.h" #include "lens.h" +using std::max; +using std::min; + TypeHandle ScissorEffect::_type_handle; /** @@ -155,7 +158,7 @@ xform(const LMatrix4 &mat) const { * */ void ScissorEffect:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type() << ":"; if (is_screen()) { out << "screen [" << _frame << "]"; diff --git a/panda/src/pgraph/shadeModelAttrib.cxx b/panda/src/pgraph/shadeModelAttrib.cxx index dea61a8521..26fac679b4 100644 --- a/panda/src/pgraph/shadeModelAttrib.cxx +++ b/panda/src/pgraph/shadeModelAttrib.cxx @@ -45,7 +45,7 @@ make_default() { * */ void ShadeModelAttrib:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type() << ":"; switch (get_mode()) { case M_flat: diff --git a/panda/src/pgraph/shaderAttrib.cxx b/panda/src/pgraph/shaderAttrib.cxx index 982497497e..e519289b28 100644 --- a/panda/src/pgraph/shaderAttrib.cxx +++ b/panda/src/pgraph/shaderAttrib.cxx @@ -29,6 +29,9 @@ #include "paramTexture.h" #include "shaderBuffer.h" +using std::ostream; +using std::ostringstream; + TypeHandle ShaderAttrib::_type_handle; int ShaderAttrib::_attrib_slot; @@ -214,9 +217,9 @@ set_shader_input(ShaderInput &&input) const { ShaderAttrib *result = new ShaderAttrib(*this); Inputs::iterator i = result->_inputs.find(input.get_name()); if (i == result->_inputs.end()) { - result->_inputs.insert(Inputs::value_type(input.get_name(), move(input))); + result->_inputs.insert(Inputs::value_type(input.get_name(), std::move(input))); } else { - i->second = move(input); + i->second = std::move(input); } return return_new(result); } @@ -247,7 +250,7 @@ clear_shader_input(const InternalName *id) const { * */ CPT(RenderAttrib) ShaderAttrib:: -clear_shader_input(const string &id) const { +clear_shader_input(const std::string &id) const { return clear_shader_input(InternalName::make(id)); } @@ -280,7 +283,7 @@ get_shader_input(const InternalName *id) const { * function does not return NULL --- it returns the "blank" ShaderInput. */ const ShaderInput &ShaderAttrib:: -get_shader_input(const string &id) const { +get_shader_input(const std::string &id) const { return get_shader_input(InternalName::make(id)); } diff --git a/panda/src/pgraph/shaderAttrib_ext.cxx b/panda/src/pgraph/shaderAttrib_ext.cxx index b98badf71b..54acefe0ec 100644 --- a/panda/src/pgraph/shaderAttrib_ext.cxx +++ b/panda/src/pgraph/shaderAttrib_ext.cxx @@ -24,7 +24,7 @@ set_shader_input(CPT_InternalName name, PyObject *value, int priority) const { ShaderAttrib *attrib = new ShaderAttrib(*_this); ShaderInput &input = attrib->_inputs[name]; - invoke_extension(&input).__init__(move(name), value); + invoke_extension(&input).__init__(std::move(name), value); return ShaderAttrib::return_new(attrib); } @@ -60,9 +60,9 @@ set_shader_inputs(PyObject *args, PyObject *kwargs) const { return nullptr; } - CPT_InternalName name(string(buffer, length)); + CPT_InternalName name(std::string(buffer, length)); ShaderInput &input = attrib->_inputs[name]; - invoke_extension(&input).__init__(move(name), value); + invoke_extension(&input).__init__(std::move(name), value); } return ShaderAttrib::return_new(attrib); diff --git a/panda/src/pgraph/shaderInput.cxx b/panda/src/pgraph/shaderInput.cxx index a1d698cce7..b017045b22 100644 --- a/panda/src/pgraph/shaderInput.cxx +++ b/panda/src/pgraph/shaderInput.cxx @@ -30,7 +30,7 @@ get_blank() { */ ShaderInput:: ShaderInput(CPT_InternalName name, const NodePath &np, int priority) : - _name(move(name)), + _name(std::move(name)), _type(M_nodepath), _priority(priority), _value(new ParamNodePath(np)) @@ -42,7 +42,7 @@ ShaderInput(CPT_InternalName name, const NodePath &np, int priority) : */ ShaderInput:: ShaderInput(CPT_InternalName name, Texture *tex, bool read, bool write, int z, int n, int priority) : - _name(move(name)), + _name(std::move(name)), _type(M_texture_image), _priority(priority), _value(new ParamTextureImage(tex, read, write, z, n)) @@ -54,7 +54,7 @@ ShaderInput(CPT_InternalName name, Texture *tex, bool read, bool write, int z, i */ ShaderInput:: ShaderInput(CPT_InternalName name, Texture *tex, const SamplerState &sampler, int priority) : - _name(move(name)), + _name(std::move(name)), _type(M_texture_sampler), _priority(priority), _value(new ParamTextureSampler(tex, sampler)) diff --git a/panda/src/pgraph/shaderInput_ext.cxx b/panda/src/pgraph/shaderInput_ext.cxx index d09a971b46..72a4d74de3 100644 --- a/panda/src/pgraph/shaderInput_ext.cxx +++ b/panda/src/pgraph/shaderInput_ext.cxx @@ -58,7 +58,7 @@ extern struct Dtool_PyTypedObject Dtool_ParamValueBase; */ void Extension:: __init__(CPT_InternalName name, PyObject *value, int priority) { - _this->_name = move(name); + _this->_name = std::move(name); _this->_priority = priority; if (PyTuple_CheckExact(value) && PyTuple_GET_SIZE(value) <= 4) { diff --git a/panda/src/pgraph/shaderPool.cxx b/panda/src/pgraph/shaderPool.cxx index 87823b9e50..0806b5ed32 100644 --- a/panda/src/pgraph/shaderPool.cxx +++ b/panda/src/pgraph/shaderPool.cxx @@ -25,7 +25,7 @@ ShaderPool *ShaderPool::_global_ptr = nullptr; * Lists the contents of the shader pool to the indicated output stream. */ void ShaderPool:: -write(ostream &out) { +write(std::ostream &out) { get_ptr()->ns_list_contents(out); } @@ -77,7 +77,7 @@ ns_load_shader(const Filename &orig_filename) { // the file extension. This is really just guesswork - there are no // standardized extensions for shaders, especially for GLSL. These are the // ones that appear to be closest to "standard". - string ext = downcase(filename.get_extension()); + std::string ext = downcase(filename.get_extension()); if (ext == "cg" || ext == "sha") { // "sha" is for historical reasons. lang = Shader::SL_Cg; @@ -182,7 +182,7 @@ ns_garbage_collect() { * The nonstatic implementation of list_contents(). */ void ShaderPool:: -ns_list_contents(ostream &out) const { +ns_list_contents(std::ostream &out) const { LightMutexHolder holder(_lock); out << _shaders.size() << " shaders:\n"; diff --git a/panda/src/pgraph/stencilAttrib.cxx b/panda/src/pgraph/stencilAttrib.cxx index 13a00165ed..52b047652b 100644 --- a/panda/src/pgraph/stencilAttrib.cxx +++ b/panda/src/pgraph/stencilAttrib.cxx @@ -264,7 +264,7 @@ make_2_sided_with_clear( * */ void StencilAttrib:: -output(ostream &out) const { +output(std::ostream &out) const { int index; for (index = 0; index < SRS_total; index++) { diff --git a/panda/src/pgraph/test_pgraph.cxx b/panda/src/pgraph/test_pgraph.cxx index 45df2fe578..cb2e3a4dde 100644 --- a/panda/src/pgraph/test_pgraph.cxx +++ b/panda/src/pgraph/test_pgraph.cxx @@ -17,13 +17,15 @@ #include "findApproxLevelEntry.h" #include "clockObject.h" +using std::cerr; + NodePath -build_tree(const string &name, int depth) { +build_tree(const std::string &name, int depth) { NodePath node(name); if (depth > 1) { for (int i = 0; i < 3; i++) { char letter = 'a' + i; - string child_name = name + string(1, letter); + std::string child_name = name + std::string(1, letter); NodePath child = build_tree(child_name, depth - 1); child.reparent_to(node); } diff --git a/panda/src/pgraph/texGenAttrib.cxx b/panda/src/pgraph/texGenAttrib.cxx index 9842d1158f..32216dab88 100644 --- a/panda/src/pgraph/texGenAttrib.cxx +++ b/panda/src/pgraph/texGenAttrib.cxx @@ -190,7 +190,7 @@ get_constant_value(TextureStage *stage) const { * */ void TexGenAttrib:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type() << ":"; Stages::const_iterator mi; diff --git a/panda/src/pgraph/texMatrixAttrib.cxx b/panda/src/pgraph/texMatrixAttrib.cxx index a228b79072..f32e0a8b97 100644 --- a/panda/src/pgraph/texMatrixAttrib.cxx +++ b/panda/src/pgraph/texMatrixAttrib.cxx @@ -179,7 +179,7 @@ get_transform(TextureStage *stage) const { * */ void TexMatrixAttrib:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type() << ":"; Stages::const_iterator mi; diff --git a/panda/src/pgraph/texProjectorEffect.cxx b/panda/src/pgraph/texProjectorEffect.cxx index 5d850ab0f5..456c6556e2 100644 --- a/panda/src/pgraph/texProjectorEffect.cxx +++ b/panda/src/pgraph/texProjectorEffect.cxx @@ -142,7 +142,7 @@ get_lens_index(TextureStage *stage) const { * */ void TexProjectorEffect:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type() << ":"; Stages::const_iterator mi; diff --git a/panda/src/pgraph/textureAttrib.cxx b/panda/src/pgraph/textureAttrib.cxx index 49bf20f5b9..7f9c6ff8b8 100644 --- a/panda/src/pgraph/textureAttrib.cxx +++ b/panda/src/pgraph/textureAttrib.cxx @@ -345,7 +345,7 @@ lower_attrib_can_override() const { * */ void TextureAttrib:: -output(ostream &out) const { +output(std::ostream &out) const { check_sorted(); out << get_type() << ":"; @@ -891,7 +891,7 @@ fillin(DatagramIterator &scan, BamReader *manager) { override = scan.get_int32(); } - _next_implicit_sort = max(_next_implicit_sort, implicit_sort + 1); + _next_implicit_sort = std::max(_next_implicit_sort, implicit_sort + 1); Stages::iterator si = _on_stages.insert_nonunique(StageNode(nullptr, _next_implicit_sort, override)); ++_next_implicit_sort; diff --git a/panda/src/pgraph/textureStageCollection.cxx b/panda/src/pgraph/textureStageCollection.cxx index 33e3ce00a6..b7fe96d885 100644 --- a/panda/src/pgraph/textureStageCollection.cxx +++ b/panda/src/pgraph/textureStageCollection.cxx @@ -176,7 +176,7 @@ clear() { * any, or NULL if no texture_stage has that name. */ TextureStage *TextureStageCollection:: -find_texture_stage(const string &name) const { +find_texture_stage(const std::string &name) const { int num_texture_stages = get_num_texture_stages(); for (int i = 0; i < num_texture_stages; i++) { TextureStage *texture_stage = get_texture_stage(i); @@ -240,7 +240,7 @@ sort() { * indicated output stream. */ void TextureStageCollection:: -output(ostream &out) const { +output(std::ostream &out) const { if (get_num_texture_stages() == 1) { out << "1 TextureStage"; } else { @@ -253,7 +253,7 @@ output(ostream &out) const { * the indicated output stream. */ void TextureStageCollection:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { for (int i = 0; i < get_num_texture_stages(); i++) { indent(out, indent_level) << *get_texture_stage(i) << "\n"; } diff --git a/panda/src/pgraph/transformState.cxx b/panda/src/pgraph/transformState.cxx index a58bd78510..453fb505b4 100644 --- a/panda/src/pgraph/transformState.cxx +++ b/panda/src/pgraph/transformState.cxx @@ -24,6 +24,8 @@ #include "lightMutexHolder.h" #include "thread.h" +using std::ostream; + LightReMutex *TransformState::_states_lock = nullptr; TransformState::States *TransformState::_states = nullptr; CPT(TransformState) TransformState::_identity_state; @@ -1025,7 +1027,7 @@ get_num_unused_states() { const TransformState *result = state->_composition_cache.get_data(i)._result; if (result != nullptr && result != state) { // Here's a TransformState that's recorded in the cache. Count it. - pair ir = + std::pair ir = state_count.insert(StateCount::value_type(result, 1)); if (!ir.second) { // If the above insert operation fails, then it's already in the @@ -1038,7 +1040,7 @@ get_num_unused_states() { for (i = 0; i < cache_size; ++i) { const TransformState *result = state->_invert_composition_cache.get_data(i)._result; if (result != nullptr && result != state) { - pair ir = + std::pair ir = state_count.insert(StateCount::value_type(result, 1)); if (!ir.second) { (*(ir.first)).second++; @@ -1170,7 +1172,7 @@ garbage_collect() { // How many elements to process this pass? size_t size = orig_size; - size_t num_this_pass = max(0, int(size * garbage_collect_states_rate)); + size_t num_this_pass = std::max(0, int(size * garbage_collect_states_rate)); if (num_this_pass <= 0) { return 0; } @@ -1182,7 +1184,7 @@ garbage_collect() { si = 0; } - num_this_pass = min(num_this_pass, size); + num_this_pass = std::min(num_this_pass, size); size_t stop_at_element = (si + num_this_pass) % size; do { diff --git a/panda/src/pgraph/transparencyAttrib.cxx b/panda/src/pgraph/transparencyAttrib.cxx index ad105f3214..146e0aa5b4 100644 --- a/panda/src/pgraph/transparencyAttrib.cxx +++ b/panda/src/pgraph/transparencyAttrib.cxx @@ -44,7 +44,7 @@ make_default() { * */ void TransparencyAttrib:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type() << ":"; switch (get_mode()) { case M_none: diff --git a/panda/src/pgraph/weakNodePath.cxx b/panda/src/pgraph/weakNodePath.cxx index a83d797cc9..c4d75aad5e 100644 --- a/panda/src/pgraph/weakNodePath.cxx +++ b/panda/src/pgraph/weakNodePath.cxx @@ -17,7 +17,7 @@ * */ void WeakNodePath:: -output(ostream &out) const { +output(std::ostream &out) const { if (was_deleted()) { out << "deleted"; } else { diff --git a/panda/src/pgraph/workingNodePath.cxx b/panda/src/pgraph/workingNodePath.cxx index af9a1fb8e8..0431a1fb85 100644 --- a/panda/src/pgraph/workingNodePath.cxx +++ b/panda/src/pgraph/workingNodePath.cxx @@ -71,7 +71,7 @@ get_node(int index) const { * */ void WorkingNodePath:: -output(ostream &out) const { +output(std::ostream &out) const { // Cheesy and slow, but when you're outputting the thing, presumably you're // not in a hurry. get_node_path().output(out); diff --git a/panda/src/pgraphnodes/ambientLight.cxx b/panda/src/pgraphnodes/ambientLight.cxx index d3aae3fb54..deb6eed6cc 100644 --- a/panda/src/pgraphnodes/ambientLight.cxx +++ b/panda/src/pgraphnodes/ambientLight.cxx @@ -23,7 +23,7 @@ TypeHandle AmbientLight::_type_handle; * */ AmbientLight:: -AmbientLight(const string &name) : +AmbientLight(const std::string &name) : LightNode(name) { } @@ -63,7 +63,7 @@ make_copy() const { * */ void AmbientLight:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << *this << ":\n"; indent(out, indent_level + 2) << "color " << get_color() << "\n"; diff --git a/panda/src/pgraphnodes/callbackNode.cxx b/panda/src/pgraphnodes/callbackNode.cxx index 12018de8da..bf0a233f3c 100644 --- a/panda/src/pgraphnodes/callbackNode.cxx +++ b/panda/src/pgraphnodes/callbackNode.cxx @@ -26,7 +26,7 @@ TypeHandle CallbackNode::_type_handle; * */ CallbackNode:: -CallbackNode(const string &name) : +CallbackNode(const std::string &name) : PandaNode(name) { PandaNode::set_cull_callback(); @@ -145,7 +145,7 @@ add_for_draw(CullTraverser *trav, CullTraverserData &data) { * classes to include some information relevant to the class. */ void CallbackNode:: -output(ostream &out) const { +output(std::ostream &out) const { PandaNode::output(out); } diff --git a/panda/src/pgraphnodes/computeNode.cxx b/panda/src/pgraphnodes/computeNode.cxx index 0a55d988ef..560e1a8365 100644 --- a/panda/src/pgraphnodes/computeNode.cxx +++ b/panda/src/pgraphnodes/computeNode.cxx @@ -27,7 +27,7 @@ TypeHandle ComputeNode::_type_handle; * assign a shader using a ShaderAttrib. */ ComputeNode:: -ComputeNode(const string &name) : +ComputeNode(const std::string &name) : PandaNode(name), _dispatcher(new ComputeNode::Dispatcher) { @@ -105,7 +105,7 @@ add_for_draw(CullTraverser *trav, CullTraverserData &data) { * classes to include some information relevant to the class. */ void ComputeNode:: -output(ostream &out) const { +output(std::ostream &out) const { PandaNode::output(out); } diff --git a/panda/src/pgraphnodes/directionalLight.cxx b/panda/src/pgraphnodes/directionalLight.cxx index 9d198fac6f..062d2d364d 100644 --- a/panda/src/pgraphnodes/directionalLight.cxx +++ b/panda/src/pgraphnodes/directionalLight.cxx @@ -55,7 +55,7 @@ fillin(DatagramIterator &scan, BamReader *) { * */ DirectionalLight:: -DirectionalLight(const string &name) : +DirectionalLight(const std::string &name) : LightLensNode(name, new OrthographicLens()) { _lenses[0]._lens->set_interocular_distance(0); } @@ -98,7 +98,7 @@ xform(const LMatrix4 &mat) { * */ void DirectionalLight:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << *this << ":\n"; indent(out, indent_level + 2) << "color " << get_color() << "\n"; diff --git a/panda/src/pgraphnodes/fadeLodNode.cxx b/panda/src/pgraphnodes/fadeLodNode.cxx index 92141d7f2d..f523d01795 100644 --- a/panda/src/pgraphnodes/fadeLodNode.cxx +++ b/panda/src/pgraphnodes/fadeLodNode.cxx @@ -28,7 +28,7 @@ TypeHandle FadeLODNode::_type_handle; * */ FadeLODNode:: -FadeLODNode(const string &name) : +FadeLODNode(const std::string &name) : LODNode(name) { set_cull_callback(); @@ -241,7 +241,7 @@ cull_callback(CullTraverser *trav, CullTraverserData &data) { * */ void FadeLODNode:: -output(ostream &out) const { +output(std::ostream &out) const { LODNode::output(out); out << " fade time: " << _fade_time; } @@ -251,7 +251,7 @@ output(ostream &out) const { * of the geometry during a transition. */ void FadeLODNode:: -set_fade_bin(const string &name, int draw_order) { +set_fade_bin(const std::string &name, int draw_order) { _fade_bin_name = name; _fade_bin_draw_order = draw_order; _fade_1_new_state.clear(); diff --git a/panda/src/pgraphnodes/fadeLodNodeData.cxx b/panda/src/pgraphnodes/fadeLodNodeData.cxx index d0f0d09987..5e15112fd3 100644 --- a/panda/src/pgraphnodes/fadeLodNodeData.cxx +++ b/panda/src/pgraphnodes/fadeLodNodeData.cxx @@ -20,7 +20,7 @@ TypeHandle FadeLODNodeData::_type_handle; * */ void FadeLODNodeData:: -output(ostream &out) const { +output(std::ostream &out) const { AuxSceneData::output(out); if (_fade_mode != FM_solid) { out << " fading " << _fade_out << " to " << _fade_in << " since " diff --git a/panda/src/pgraphnodes/lightLensNode.cxx b/panda/src/pgraphnodes/lightLensNode.cxx index b79b5e8dc0..87f9a5bca8 100644 --- a/panda/src/pgraphnodes/lightLensNode.cxx +++ b/panda/src/pgraphnodes/lightLensNode.cxx @@ -26,7 +26,7 @@ TypeHandle LightLensNode::_type_handle; * */ LightLensNode:: -LightLensNode(const string &name, Lens *lens) : +LightLensNode(const std::string &name, Lens *lens) : Camera(name, lens), _has_specular_color(false), _attrib_count(0) @@ -158,7 +158,7 @@ as_light() { * */ void LightLensNode:: -output(ostream &out) const { +output(std::ostream &out) const { LensNode::output(out); } @@ -166,7 +166,7 @@ output(ostream &out) const { * */ void LightLensNode:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { LensNode::write(out, indent_level); } diff --git a/panda/src/pgraphnodes/lightNode.cxx b/panda/src/pgraphnodes/lightNode.cxx index 13eae68d6d..cffcb05a2f 100644 --- a/panda/src/pgraphnodes/lightNode.cxx +++ b/panda/src/pgraphnodes/lightNode.cxx @@ -23,7 +23,7 @@ TypeHandle LightNode::_type_handle; * */ LightNode:: -LightNode(const string &name) : +LightNode(const std::string &name) : PandaNode(name) { } @@ -59,7 +59,7 @@ as_light() { * */ void LightNode:: -output(ostream &out) const { +output(std::ostream &out) const { PandaNode::output(out); } @@ -67,7 +67,7 @@ output(ostream &out) const { * */ void LightNode:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { PandaNode::write(out, indent_level); } diff --git a/panda/src/pgraphnodes/lodNode.cxx b/panda/src/pgraphnodes/lodNode.cxx index e39f0d0c97..060adac699 100644 --- a/panda/src/pgraphnodes/lodNode.cxx +++ b/panda/src/pgraphnodes/lodNode.cxx @@ -45,7 +45,7 @@ TypeHandle LODNode::_type_handle; * variable. */ PT(LODNode) LODNode:: -make_default_lod(const string &name) { +make_default_lod(const std::string &name) { switch (default_lod_type.get_value()) { case LNT_pop: return new LODNode(name); @@ -146,7 +146,7 @@ cull_callback(CullTraverser *trav, CullTraverserData &data) { LPoint3 center = cdata->_center * rel_transform->get_mat(); PN_stdfloat dist2 = center.dot(center); - int num_children = min(get_num_children(), (int)cdata->_switch_vector.size()); + int num_children = std::min(get_num_children(), (int)cdata->_switch_vector.size()); for (int index = 0; index < num_children; ++index) { const Switch &sw = cdata->_switch_vector[index]; bool in_range; @@ -176,7 +176,7 @@ cull_callback(CullTraverser *trav, CullTraverserData &data) { * */ void LODNode:: -output(ostream &out) const { +output(std::ostream &out) const { PandaNode::output(out); CDReader cdata(_cycler); out << " center(" << cdata->_center << ") "; @@ -593,7 +593,7 @@ do_verify_child_bounds(const LODNode::CData *cdata, int index, // should definitely fit entirely within a bounding sphere that contains // all the points of the child. LPoint3 box_center = (min_point + max_point) / 2.0f; - PN_stdfloat box_radius = min(min(max_point[0] - box_center[0], + PN_stdfloat box_radius = std::min(std::min(max_point[0] - box_center[0], max_point[1] - box_center[1]), max_point[2] - box_center[2]); @@ -642,7 +642,7 @@ do_auto_verify_lods(CullTraverser *trav, CullTraverserData &data) { PN_stdfloat suggested_radius; if (!do_verify_child_bounds(cdata, index, suggested_radius)) { const Switch &sw = cdata->_switch_vector[index]; - ostringstream strm; + std::ostringstream strm; strm << "Level " << index << " geometry of " << data.get_node_path() << " is larger than its switch radius; suggest radius of " diff --git a/panda/src/pgraphnodes/lodNodeType.cxx b/panda/src/pgraphnodes/lodNodeType.cxx index 2798cdd0f4..5c37066cf5 100644 --- a/panda/src/pgraphnodes/lodNodeType.cxx +++ b/panda/src/pgraphnodes/lodNodeType.cxx @@ -15,6 +15,10 @@ #include "string_utils.h" #include "config_pgraph.h" +using std::istream; +using std::ostream; +using std::string; + ostream & operator << (ostream &out, LODNodeType lnt) { switch (lnt) { diff --git a/panda/src/pgraphnodes/nodeCullCallbackData.cxx b/panda/src/pgraphnodes/nodeCullCallbackData.cxx index e4ee2acdb1..5a9dbc9e0a 100644 --- a/panda/src/pgraphnodes/nodeCullCallbackData.cxx +++ b/panda/src/pgraphnodes/nodeCullCallbackData.cxx @@ -24,7 +24,7 @@ TypeHandle NodeCullCallbackData::_type_handle; * */ void NodeCullCallbackData:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type() << "(" << (void *)_trav << ", " << (void *)&_data << ")"; } diff --git a/panda/src/pgraphnodes/pointLight.cxx b/panda/src/pgraphnodes/pointLight.cxx index 02cc33fda9..8a132515aa 100644 --- a/panda/src/pgraphnodes/pointLight.cxx +++ b/panda/src/pgraphnodes/pointLight.cxx @@ -61,7 +61,7 @@ fillin(DatagramIterator &scan, BamReader *manager) { * */ PointLight:: -PointLight(const string &name) : +PointLight(const std::string &name) : LightLensNode(name) { PT(Lens) lens; lens = new PerspectiveLens(90, 90); @@ -127,7 +127,7 @@ xform(const LMatrix4 &mat) { * */ void PointLight:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << *this << ":\n"; indent(out, indent_level + 2) << "color " << get_color() << "\n"; diff --git a/panda/src/pgraphnodes/rectangleLight.cxx b/panda/src/pgraphnodes/rectangleLight.cxx index 187d35cd2d..1af641788c 100644 --- a/panda/src/pgraphnodes/rectangleLight.cxx +++ b/panda/src/pgraphnodes/rectangleLight.cxx @@ -50,7 +50,7 @@ fillin(DatagramIterator &scan, BamReader *manager) { * */ RectangleLight:: -RectangleLight(const string &name) : +RectangleLight(const std::string &name) : LightLensNode(name) { } @@ -80,7 +80,7 @@ make_copy() const { * */ void RectangleLight:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { LightLensNode::write(out, indent_level); indent(out, indent_level) << *this << "\n"; } diff --git a/panda/src/pgraphnodes/sceneGraphAnalyzer.cxx b/panda/src/pgraphnodes/sceneGraphAnalyzer.cxx index 7e374721f6..915845af86 100644 --- a/panda/src/pgraphnodes/sceneGraphAnalyzer.cxx +++ b/panda/src/pgraphnodes/sceneGraphAnalyzer.cxx @@ -111,7 +111,7 @@ add_node(PandaNode *node) { * Describes all the data collected. */ void SceneGraphAnalyzer:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << _num_nodes << " total nodes (including " << _num_instances << " instances); " << _num_lod_nodes << " LODNodes.\n"; @@ -366,7 +366,7 @@ collect_statistics(GeomNode *geom_node) { void SceneGraphAnalyzer:: collect_statistics(const Geom *geom) { CPT(GeomVertexData) vdata = geom->get_vertex_data(); - pair result = _vdatas.insert(VDatas::value_type(vdata, VDataTracker())); + std::pair result = _vdatas.insert(VDatas::value_type(vdata, VDataTracker())); if (result.second) { // This is the first time we've encountered this vertex data. ++_num_geom_vertex_datas; diff --git a/panda/src/pgraphnodes/sequenceNode.cxx b/panda/src/pgraphnodes/sequenceNode.cxx index b8f3ffb8e0..06f0019e6d 100644 --- a/panda/src/pgraphnodes/sequenceNode.cxx +++ b/panda/src/pgraphnodes/sequenceNode.cxx @@ -134,7 +134,7 @@ get_visible_child() const { * */ void SequenceNode:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type() << " " << get_name() << ": "; AnimInterface::output(out); } diff --git a/panda/src/pgraphnodes/shaderGenerator.cxx b/panda/src/pgraphnodes/shaderGenerator.cxx index bdca5406ce..dceb4abf4b 100644 --- a/panda/src/pgraphnodes/shaderGenerator.cxx +++ b/panda/src/pgraphnodes/shaderGenerator.cxx @@ -47,6 +47,8 @@ #include "config_pgraphnodes.h" #include "pStatTimer.h" +using std::string; + TypeHandle ShaderGenerator::_type_handle; #ifdef HAVE_CG @@ -703,7 +705,7 @@ synthesize_shader(const RenderState *rs, const GeomVertexAnimationSpec &anim) { // Generate the shader's text. - ostringstream text; + std::ostringstream text; text << "//Cg\n"; @@ -1622,7 +1624,7 @@ synthesize_shader(const RenderState *rs, const GeomVertexAnimationSpec &anim) { */ string ShaderGenerator:: combine_mode_as_string(const ShaderKey::TextureInfo &info, TextureStage::CombineMode c_mode, bool alpha, short texindex) { - ostringstream text; + std::ostringstream text; switch (c_mode) { case TextureStage::CM_modulate: text << combine_source_as_string(info, 0, alpha, texindex); @@ -1688,7 +1690,7 @@ combine_source_as_string(const ShaderKey::TextureInfo &info, short num, bool alp c_src = UNPACK_COMBINE_SRC(info._combine_alpha, num); c_op = UNPACK_COMBINE_OP(info._combine_alpha, num); } - ostringstream csource; + std::ostringstream csource; if (c_op == TextureStage::CO_one_minus_src_color || c_op == TextureStage::CO_one_minus_src_alpha) { csource << "saturate(1.0f - "; diff --git a/panda/src/pgraphnodes/sphereLight.cxx b/panda/src/pgraphnodes/sphereLight.cxx index c4cf01be5a..6cd70c2fbb 100644 --- a/panda/src/pgraphnodes/sphereLight.cxx +++ b/panda/src/pgraphnodes/sphereLight.cxx @@ -50,7 +50,7 @@ fillin(DatagramIterator &scan, BamReader *manager) { * */ SphereLight:: -SphereLight(const string &name) : +SphereLight(const std::string &name) : PointLight(name) { } @@ -92,7 +92,7 @@ xform(const LMatrix4 &mat) { * */ void SphereLight:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { PointLight::write(out, indent_level); indent(out, indent_level) << *this << ":\n"; indent(out, indent_level + 2) diff --git a/panda/src/pgraphnodes/spotlight.cxx b/panda/src/pgraphnodes/spotlight.cxx index 5935485ceb..a7d334e721 100644 --- a/panda/src/pgraphnodes/spotlight.cxx +++ b/panda/src/pgraphnodes/spotlight.cxx @@ -64,7 +64,7 @@ fillin(DatagramIterator &scan, BamReader *manager) { * */ Spotlight:: -Spotlight(const string &name) : +Spotlight(const std::string &name) : LightLensNode(name) { _lenses[0]._lens->set_interocular_distance(0); } @@ -104,7 +104,7 @@ xform(const LMatrix4 &mat) { * */ void Spotlight:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << *this << ":\n"; indent(out, indent_level + 2) << "color " << get_color() << "\n"; diff --git a/panda/src/pgui/pgButton.cxx b/panda/src/pgui/pgButton.cxx index 14821b017e..d1eba186c0 100644 --- a/panda/src/pgui/pgButton.cxx +++ b/panda/src/pgui/pgButton.cxx @@ -26,7 +26,7 @@ TypeHandle PGButton::_type_handle; * */ PGButton:: -PGButton(const string &name) : PGItem(name) +PGButton(const std::string &name) : PGItem(name) { _button_down = false; _click_buttons.insert(MouseButton::one()); @@ -134,7 +134,7 @@ void PGButton:: click(const MouseWatcherParameter ¶m) { LightReMutexHolder holder(_lock); PGMouseWatcherParameter *ep = new PGMouseWatcherParameter(param); - string event = get_click_event(param.get_button()); + std::string event = get_click_event(param.get_button()); play_sound(event); throw_event(event, EventParameter(ep)); @@ -150,7 +150,7 @@ click(const MouseWatcherParameter ¶m) { * to the size of the text. */ void PGButton:: -setup(const string &label, PN_stdfloat bevel) { +setup(const std::string &label, PN_stdfloat bevel) { LightReMutexHolder holder(_lock); clear_state_def(S_ready); clear_state_def(S_depressed); diff --git a/panda/src/pgui/pgEntry.cxx b/panda/src/pgui/pgEntry.cxx index bc8fb204c7..b6a86754d7 100644 --- a/panda/src/pgui/pgEntry.cxx +++ b/panda/src/pgui/pgEntry.cxx @@ -27,6 +27,11 @@ #include +using std::max; +using std::min; +using std::string; +using std::wstring; + TypeHandle PGEntry::_type_handle; /** diff --git a/panda/src/pgui/pgFrameStyle.cxx b/panda/src/pgui/pgFrameStyle.cxx index 0f0458265c..b4590bf8f0 100644 --- a/panda/src/pgui/pgFrameStyle.cxx +++ b/panda/src/pgui/pgFrameStyle.cxx @@ -25,13 +25,16 @@ #include "geomTristrips.h" #include "geomVertexWriter.h" +using std::max; +using std::min; + // Specifies the UV range of textures applied to the frame. Maybe we'll have // a reason to make this a parameter of the frame style one day, but for now // it's hardcoded to fit the entire texture over the rectangular frame. static const LVecBase4 uv_range = LVecBase4(0.0f, 1.0f, 0.0f, 1.0f); -ostream & -operator << (ostream &out, PGFrameStyle::Type type) { +std::ostream & +operator << (std::ostream &out, PGFrameStyle::Type type) { switch (type) { case PGFrameStyle::T_none: return out << "none"; @@ -92,7 +95,7 @@ get_internal_frame(const LVecBase4 &frame) const { * */ void PGFrameStyle:: -output(ostream &out) const { +output(std::ostream &out) const { out << _type << " color = " << _color << " width = " << _width; if (_visible_scale != LVecBase2(1.0f, 1.0f)) { out << "visible_scale = " << get_visible_scale(); diff --git a/panda/src/pgui/pgItem.cxx b/panda/src/pgui/pgItem.cxx index da3dfe86ba..582c12985b 100644 --- a/panda/src/pgui/pgItem.cxx +++ b/panda/src/pgui/pgItem.cxx @@ -35,6 +35,10 @@ #include "audioSound.h" #endif +using std::max; +using std::min; +using std::string; + TypeHandle PGItem::_type_handle; PT(TextNode) PGItem::_text_node; PGItem *PGItem::_focus_item = nullptr; diff --git a/panda/src/pgui/pgMouseWatcherParameter.cxx b/panda/src/pgui/pgMouseWatcherParameter.cxx index 52844f5e23..732d5f01a4 100644 --- a/panda/src/pgui/pgMouseWatcherParameter.cxx +++ b/panda/src/pgui/pgMouseWatcherParameter.cxx @@ -26,6 +26,6 @@ PGMouseWatcherParameter:: * */ void PGMouseWatcherParameter:: -output(ostream &out) const { +output(std::ostream &out) const { MouseWatcherParameter::output(out); } diff --git a/panda/src/pgui/pgScrollFrame.cxx b/panda/src/pgui/pgScrollFrame.cxx index c35ea7b395..a41916d3c9 100644 --- a/panda/src/pgui/pgScrollFrame.cxx +++ b/panda/src/pgui/pgScrollFrame.cxx @@ -19,7 +19,7 @@ TypeHandle PGScrollFrame::_type_handle; * */ PGScrollFrame:: -PGScrollFrame(const string &name) : PGVirtualFrame(name) +PGScrollFrame(const std::string &name) : PGVirtualFrame(name) { set_cull_callback(); diff --git a/panda/src/pgui/pgSliderBar.cxx b/panda/src/pgui/pgSliderBar.cxx index ae7720140a..e085f0f91d 100644 --- a/panda/src/pgui/pgSliderBar.cxx +++ b/panda/src/pgui/pgSliderBar.cxx @@ -20,13 +20,16 @@ #include "transformState.h" #include "mouseButton.h" +using std::max; +using std::min; + TypeHandle PGSliderBar::_type_handle; /** * */ PGSliderBar:: -PGSliderBar(const string &name) +PGSliderBar(const std::string &name) : PGItem(name) { set_cull_callback(); @@ -224,7 +227,7 @@ xform(const LMatrix4 &mat) { void PGSliderBar:: adjust() { LightReMutexHolder holder(_lock); - string event = get_adjust_event(); + std::string event = get_adjust_event(); play_sound(event); throw_event(event); diff --git a/panda/src/pgui/pgTop.cxx b/panda/src/pgui/pgTop.cxx index 172f62123c..3c0948ebda 100644 --- a/panda/src/pgui/pgTop.cxx +++ b/panda/src/pgui/pgTop.cxx @@ -24,7 +24,7 @@ TypeHandle PGTop::_type_handle; * */ PGTop:: -PGTop(const string &name) : +PGTop(const std::string &name) : PandaNode(name) { set_cull_callback(); diff --git a/panda/src/pgui/pgVirtualFrame.cxx b/panda/src/pgui/pgVirtualFrame.cxx index b6a6d195b0..01013fd87f 100644 --- a/panda/src/pgui/pgVirtualFrame.cxx +++ b/panda/src/pgui/pgVirtualFrame.cxx @@ -21,7 +21,7 @@ TypeHandle PGVirtualFrame::_type_handle; * */ PGVirtualFrame:: -PGVirtualFrame(const string &name) : PGItem(name) +PGVirtualFrame(const std::string &name) : PGItem(name) { _has_clip_frame = false; _clip_frame.set(0.0f, 0.0f, 0.0f, 0.0f); diff --git a/panda/src/pgui/pgWaitBar.cxx b/panda/src/pgui/pgWaitBar.cxx index 2f6f50a557..8348b692dc 100644 --- a/panda/src/pgui/pgWaitBar.cxx +++ b/panda/src/pgui/pgWaitBar.cxx @@ -22,7 +22,7 @@ TypeHandle PGWaitBar::_type_handle; * */ PGWaitBar:: -PGWaitBar(const string &name) : PGItem(name) +PGWaitBar(const std::string &name) : PGItem(name) { set_cull_callback(); @@ -147,7 +147,7 @@ update() { // And scale the bar according to our value. PN_stdfloat frac = _value / _range; - frac = max(min(frac, (PN_stdfloat)1.0), (PN_stdfloat)0.0); + frac = std::max(std::min(frac, (PN_stdfloat)1.0), (PN_stdfloat)0.0); bar_frame[1] = bar_frame[0] + frac * (bar_frame[1] - bar_frame[0]); _bar = _bar_style.generate_into(root, bar_frame, 1); diff --git a/panda/src/physics/actorNode.cxx b/panda/src/physics/actorNode.cxx index b216036009..ac9a03a69d 100644 --- a/panda/src/physics/actorNode.cxx +++ b/panda/src/physics/actorNode.cxx @@ -23,7 +23,7 @@ TypeHandle ActorNode::_type_handle; * Constructor */ ActorNode:: -ActorNode(const string &name) : +ActorNode(const std::string &name) : PhysicalNode(name) { _contact_vector = LVector3::zero(); add_physical(new Physical(1, true)); @@ -120,7 +120,7 @@ transform_changed() { * Write a string representation of this instance to . */ void ActorNode:: -write(ostream &out, int indent) const { +write(std::ostream &out, int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""; out<<"ActorNode:\n"; out.width(indent+2); out<<""; out<<"_ok_to_callback "<<_ok_to_callback<<"\n"; diff --git a/panda/src/physics/angularEulerIntegrator.cxx b/panda/src/physics/angularEulerIntegrator.cxx index 1ca581eaf6..642c2c6b8b 100644 --- a/panda/src/physics/angularEulerIntegrator.cxx +++ b/panda/src/physics/angularEulerIntegrator.cxx @@ -142,7 +142,7 @@ child_integrate(Physical *physical, * Write a string representation of this instance to . */ void AngularEulerIntegrator:: -output(ostream &out) const { +output(std::ostream &out) const { #ifndef NDEBUG //[ out<<"AngularEulerIntegrator (id "<. */ void AngularEulerIntegrator:: -write(ostream &out, int indent) const { +write(std::ostream &out, int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""; out<<"AngularEulerIntegrator:\n"; AngularIntegrator::write(out, indent+2); diff --git a/panda/src/physics/angularForce.cxx b/panda/src/physics/angularForce.cxx index 06c71289ae..3be7eafff5 100644 --- a/panda/src/physics/angularForce.cxx +++ b/panda/src/physics/angularForce.cxx @@ -59,7 +59,7 @@ is_linear() const { * Write a string representation of this instance to . */ void AngularForce:: -output(ostream &out) const { +output(std::ostream &out) const { #ifndef NDEBUG //[ out<<"AngularForce (id "<. */ void AngularForce:: -write(ostream &out, int indent) const { +write(std::ostream &out, int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""; out<<"AngularForce (id "<. */ void AngularIntegrator:: -output(ostream &out) const { +output(std::ostream &out) const { #ifndef NDEBUG //[ out<<"AngularIntegrator"; #endif //] NDEBUG @@ -59,7 +59,7 @@ output(ostream &out) const { * Write a string representation of this instance to . */ void AngularIntegrator:: -write(ostream &out, int indent) const { +write(std::ostream &out, int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""; out<<"AngularIntegrator:\n"; out.width(indent+2); out<<""; out<<"_max_angular_dt "<<_max_angular_dt<<" (class const)\n"; diff --git a/panda/src/physics/angularVectorForce.cxx b/panda/src/physics/angularVectorForce.cxx index 736deec04f..f917eaaba7 100644 --- a/panda/src/physics/angularVectorForce.cxx +++ b/panda/src/physics/angularVectorForce.cxx @@ -68,7 +68,7 @@ get_child_quat(const PhysicsObject *) { * Write a string representation of this instance to . */ void AngularVectorForce:: -output(ostream &out) const { +output(std::ostream &out) const { #ifndef NDEBUG //[ out<<"AngularVectorForce"; #endif //] NDEBUG @@ -78,7 +78,7 @@ output(ostream &out) const { * Write a string representation of this instance to . */ void AngularVectorForce:: -write(ostream &out, int indent) const { +write(std::ostream &out, int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""; out<<"AngularVectorForce:\n"; out.width(indent+2); out<<""; out<<"_fvec "<<_fvec<<"\n"; diff --git a/panda/src/physics/baseForce.cxx b/panda/src/physics/baseForce.cxx index c06ba12180..18bc3ef5e1 100644 --- a/panda/src/physics/baseForce.cxx +++ b/panda/src/physics/baseForce.cxx @@ -48,7 +48,7 @@ BaseForce:: * Write a string representation of this instance to . */ void BaseForce:: -output(ostream &out) const { +output(std::ostream &out) const { out << "BaseForce (id " << this << ")"; } @@ -56,7 +56,7 @@ output(ostream &out) const { * Write a string representation of this instance to . */ void BaseForce:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << "BaseForce (id " << this << "):\n"; diff --git a/panda/src/physics/baseIntegrator.cxx b/panda/src/physics/baseIntegrator.cxx index ca5ec4faad..33bc0b72cb 100644 --- a/panda/src/physics/baseIntegrator.cxx +++ b/panda/src/physics/baseIntegrator.cxx @@ -16,6 +16,8 @@ #include "forceNode.h" #include "nodePath.h" +using std::ostream; + /** * constructor */ diff --git a/panda/src/physics/forceNode.cxx b/panda/src/physics/forceNode.cxx index 326962b7c1..c8f744f777 100644 --- a/panda/src/physics/forceNode.cxx +++ b/panda/src/physics/forceNode.cxx @@ -20,7 +20,7 @@ TypeHandle ForceNode::_type_handle; * default constructor */ ForceNode:: -ForceNode(const string &name) : +ForceNode(const std::string &name) : PandaNode(name) { } @@ -124,7 +124,7 @@ remove_force(size_t index) { * Write a string representation of this instance to . */ void ForceNode:: -output(ostream &out) const { +output(std::ostream &out) const { PandaNode::output(out); out<<" ("<<_forces.size()<<" forces)"; } @@ -133,7 +133,7 @@ output(ostream &out) const { * Write a string representation of this instance to . */ void ForceNode:: -write_forces(ostream &out, int indent) const { +write_forces(std::ostream &out, int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""<<"_forces ("<<_forces.size()<<" forces)"<<"\n"; for (ForceVector::const_iterator i=_forces.begin(); @@ -149,7 +149,7 @@ write_forces(ostream &out, int indent) const { * Write a string representation of this instance to . */ void ForceNode:: -write(ostream &out, int indent) const { +write(std::ostream &out, int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""; out<<"ForceNode (id "<. */ void LinearControlForce:: -output(ostream &out) const { +output(std::ostream &out) const { #ifndef NDEBUG //[ out<<"LinearControlForce"; #endif //] NDEBUG @@ -81,7 +81,7 @@ output(ostream &out) const { * Write a string representation of this instance to . */ void LinearControlForce:: -write(ostream &out, int indent) const { +write(std::ostream &out, int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""; out<<"LinearControlForce:\n"; out.width(indent+2); out<<""; out<<"_fvec "<<_fvec<<"\n"; diff --git a/panda/src/physics/linearCylinderVortexForce.cxx b/panda/src/physics/linearCylinderVortexForce.cxx index ab91296af0..c1abcc6c4d 100644 --- a/panda/src/physics/linearCylinderVortexForce.cxx +++ b/panda/src/physics/linearCylinderVortexForce.cxx @@ -117,7 +117,7 @@ get_child_vector(const PhysicsObject *po) { * Write a string representation of this instance to . */ void LinearCylinderVortexForce:: -output(ostream &out) const { +output(std::ostream &out) const { #ifndef NDEBUG //[ out<<"LinearCylinderVortexForce"; #endif //] NDEBUG @@ -127,7 +127,7 @@ output(ostream &out) const { * Write a string representation of this instance to . */ void LinearCylinderVortexForce:: -write(ostream &out, int indent) const { +write(std::ostream &out, int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""; out<<"LinearCylinderVortexForce:\n"; LinearForce::write(out, indent+2); diff --git a/panda/src/physics/linearDistanceForce.cxx b/panda/src/physics/linearDistanceForce.cxx index b48907feeb..3a7349f094 100644 --- a/panda/src/physics/linearDistanceForce.cxx +++ b/panda/src/physics/linearDistanceForce.cxx @@ -47,7 +47,7 @@ LinearDistanceForce:: * Write a string representation of this instance to . */ void LinearDistanceForce:: -output(ostream &out) const { +output(std::ostream &out) const { #ifndef NDEBUG //[ out<<"LinearDistanceForce"; #endif //] NDEBUG @@ -57,7 +57,7 @@ output(ostream &out) const { * Write a string representation of this instance to . */ void LinearDistanceForce:: -write(ostream &out, int indent) const { +write(std::ostream &out, int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""; out<<"LinearDistanceForce:\n"; out.width(indent+2); out<<""; out<<"_force_center "<<_force_center<<"\n"; diff --git a/panda/src/physics/linearEulerIntegrator.cxx b/panda/src/physics/linearEulerIntegrator.cxx index 5095937a48..f9801e3405 100644 --- a/panda/src/physics/linearEulerIntegrator.cxx +++ b/panda/src/physics/linearEulerIntegrator.cxx @@ -189,7 +189,7 @@ child_integrate(Physical *physical, * Write a string representation of this instance to . */ void LinearEulerIntegrator:: -output(ostream &out) const { +output(std::ostream &out) const { #ifndef NDEBUG //[ out<<"LinearEulerIntegrator"; #endif //] NDEBUG @@ -199,7 +199,7 @@ output(ostream &out) const { * Write a string representation of this instance to . */ void LinearEulerIntegrator:: -write(ostream &out, int indent) const { +write(std::ostream &out, int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""<<"LinearEulerIntegrator:\n"; diff --git a/panda/src/physics/linearForce.cxx b/panda/src/physics/linearForce.cxx index e7481a2703..cef7f1e543 100644 --- a/panda/src/physics/linearForce.cxx +++ b/panda/src/physics/linearForce.cxx @@ -82,7 +82,7 @@ is_linear() const { * Write a string representation of this instance to . */ void LinearForce:: -output(ostream &out) const { +output(std::ostream &out) const { #ifndef NDEBUG //[ out<<"LinearForce (id "<. */ void LinearForce:: -write(ostream &out, int indent) const { +write(std::ostream &out, int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""; out<<"LinearForce (id "<. */ void LinearFrictionForce:: -output(ostream &out) const { +output(std::ostream &out) const { #ifndef NDEBUG //[ out<<"LinearFrictionForce"; #endif //] NDEBUG @@ -83,7 +83,7 @@ output(ostream &out) const { * Write a string representation of this instance to . */ void LinearFrictionForce:: -write(ostream &out, int indent) const { +write(std::ostream &out, int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""; out<<"LinearFrictionForce:\n"; out.width(indent+2); out<<""; out<<"_coef "<<_coef<<":\n"; diff --git a/panda/src/physics/linearIntegrator.cxx b/panda/src/physics/linearIntegrator.cxx index 9efd0a3c1b..d8841cee9c 100644 --- a/panda/src/physics/linearIntegrator.cxx +++ b/panda/src/physics/linearIntegrator.cxx @@ -68,7 +68,7 @@ integrate(Physical *physical, LinearForceVector &forces, * Write a string representation of this instance to . */ void LinearIntegrator:: -output(ostream &out) const { +output(std::ostream &out) const { #ifndef NDEBUG //[ out<<"LinearIntegrator"; #endif //] NDEBUG @@ -78,7 +78,7 @@ output(ostream &out) const { * Write a string representation of this instance to . */ void LinearIntegrator:: -write(ostream &out, int indent) const { +write(std::ostream &out, int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""; out<<"LinearIntegrator:\n"; out.width(indent+2); out<<""; out<<"_max_linear_dt "<<_max_linear_dt<<" (class static)\n"; diff --git a/panda/src/physics/linearJitterForce.cxx b/panda/src/physics/linearJitterForce.cxx index 80809a0f28..397092a807 100644 --- a/panda/src/physics/linearJitterForce.cxx +++ b/panda/src/physics/linearJitterForce.cxx @@ -58,7 +58,7 @@ get_child_vector(const PhysicsObject *) { * Write a string representation of this instance to . */ void LinearJitterForce:: -output(ostream &out) const { +output(std::ostream &out) const { #ifndef NDEBUG //[ out<<"LinearJitterForce"; #endif //] NDEBUG @@ -68,7 +68,7 @@ output(ostream &out) const { * Write a string representation of this instance to . */ void LinearJitterForce:: -write(ostream &out, int indent) const { +write(std::ostream &out, int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""; out<<"LinearJitterForce:\n"; LinearRandomForce::write(out, indent+2); diff --git a/panda/src/physics/linearNoiseForce.cxx b/panda/src/physics/linearNoiseForce.cxx index b86754b8fe..9873494480 100644 --- a/panda/src/physics/linearNoiseForce.cxx +++ b/panda/src/physics/linearNoiseForce.cxx @@ -136,7 +136,7 @@ get_child_vector(const PhysicsObject *po) { * Write a string representation of this instance to . */ void LinearNoiseForce:: -output(ostream &out) const { +output(std::ostream &out) const { #ifndef NDEBUG //[ out<<""<<"LinearNoiseForce"; #endif //] NDEBUG @@ -146,7 +146,7 @@ output(ostream &out) const { * Write a string representation of this instance to . */ void LinearNoiseForce:: -write(ostream &out, int indent) const { +write(std::ostream &out, int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""<<"LinearNoiseForce:"; diff --git a/panda/src/physics/linearRandomForce.cxx b/panda/src/physics/linearRandomForce.cxx index f961fdba4e..f234b174bd 100644 --- a/panda/src/physics/linearRandomForce.cxx +++ b/panda/src/physics/linearRandomForce.cxx @@ -50,7 +50,7 @@ bounded_rand() { * Write a string representation of this instance to . */ void LinearRandomForce:: -output(ostream &out) const { +output(std::ostream &out) const { #ifndef NDEBUG //[ out<<"LinearRandomForce"; #endif //] NDEBUG @@ -60,7 +60,7 @@ output(ostream &out) const { * Write a string representation of this instance to . */ void LinearRandomForce:: -write(ostream &out, int indent) const { +write(std::ostream &out, int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""; out<<"LinearRandomForce:\n"; LinearForce::write(out, indent+2); diff --git a/panda/src/physics/linearSinkForce.cxx b/panda/src/physics/linearSinkForce.cxx index 066fc64bef..ab1268cd5c 100644 --- a/panda/src/physics/linearSinkForce.cxx +++ b/panda/src/physics/linearSinkForce.cxx @@ -68,7 +68,7 @@ get_child_vector(const PhysicsObject *po) { * Write a string representation of this instance to . */ void LinearSinkForce:: -output(ostream &out) const { +output(std::ostream &out) const { #ifndef NDEBUG //[ out<<"LinearSinkForce"; #endif //] NDEBUG @@ -78,7 +78,7 @@ output(ostream &out) const { * Write a string representation of this instance to . */ void LinearSinkForce:: -write(ostream &out, int indent) const { +write(std::ostream &out, int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""; out<<"LinearSinkForce:\n"; LinearDistanceForce::write(out, indent+2); diff --git a/panda/src/physics/linearSourceForce.cxx b/panda/src/physics/linearSourceForce.cxx index 87e8d4e6ef..4bb674dbad 100644 --- a/panda/src/physics/linearSourceForce.cxx +++ b/panda/src/physics/linearSourceForce.cxx @@ -68,7 +68,7 @@ get_child_vector(const PhysicsObject *po) { * Write a string representation of this instance to . */ void LinearSourceForce:: -output(ostream &out) const { +output(std::ostream &out) const { #ifndef NDEBUG //[ out<<"LinearSourceForce"; #endif //] NDEBUG @@ -78,7 +78,7 @@ output(ostream &out) const { * Write a string representation of this instance to . */ void LinearSourceForce:: -write(ostream &out, int indent) const { +write(std::ostream &out, int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""; out<<"LinearSourceForce:\n"; LinearDistanceForce::write(out, indent+2); diff --git a/panda/src/physics/linearUserDefinedForce.cxx b/panda/src/physics/linearUserDefinedForce.cxx index 8e009aa6d9..2bab34805a 100644 --- a/panda/src/physics/linearUserDefinedForce.cxx +++ b/panda/src/physics/linearUserDefinedForce.cxx @@ -62,7 +62,7 @@ get_child_vector(const PhysicsObject *po) { * Write a string representation of this instance to . */ void LinearUserDefinedForce:: -output(ostream &out) const { +output(std::ostream &out) const { #ifndef NDEBUG //[ out<<"LinearUserDefinedForce"; #endif //] NDEBUG @@ -72,7 +72,7 @@ output(ostream &out) const { * Write a string representation of this instance to . */ void LinearUserDefinedForce:: -write(ostream &out, int indent) const { +write(std::ostream &out, int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""; out<<"LinearUserDefinedForce:\n"; LinearForce::write(out, indent+2); diff --git a/panda/src/physics/linearVectorForce.cxx b/panda/src/physics/linearVectorForce.cxx index ed2012dccf..3247bb5ad5 100644 --- a/panda/src/physics/linearVectorForce.cxx +++ b/panda/src/physics/linearVectorForce.cxx @@ -74,7 +74,7 @@ get_child_vector(const PhysicsObject *) { * Write a string representation of this instance to . */ void LinearVectorForce:: -output(ostream &out) const { +output(std::ostream &out) const { #ifndef NDEBUG //[ out<<"LinearVectorForce"; #endif //] NDEBUG @@ -84,7 +84,7 @@ output(ostream &out) const { * Write a string representation of this instance to . */ void LinearVectorForce:: -write(ostream &out, int indent) const { +write(std::ostream &out, int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""; out<<"LinearVectorForce:\n"; out.width(indent+2); out<<""; out<<"_fvec "<<_fvec<<"\n"; diff --git a/panda/src/physics/physical.cxx b/panda/src/physics/physical.cxx index 1cad199507..afd158ec14 100644 --- a/panda/src/physics/physical.cxx +++ b/panda/src/physics/physical.cxx @@ -16,6 +16,8 @@ #include "physical.h" #include "physicsManager.h" +using std::ostream; + TypeHandle Physical::_type_handle; /** diff --git a/panda/src/physics/physicalNode.cxx b/panda/src/physics/physicalNode.cxx index 0166b81ade..0fcabeeb8a 100644 --- a/panda/src/physics/physicalNode.cxx +++ b/panda/src/physics/physicalNode.cxx @@ -21,7 +21,7 @@ TypeHandle PhysicalNode::_type_handle; * default constructor */ PhysicalNode:: -PhysicalNode(const string &name) : +PhysicalNode(const std::string &name) : PandaNode(name) { } @@ -133,7 +133,7 @@ remove_physical(size_t index) { * Write a string representation of this instance to . */ void PhysicalNode:: -write(ostream &out, int indent) const { +write(std::ostream &out, int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""; out<<"PhysicalNode:\n"; // PandaNode::write(out, indent+2); diff --git a/panda/src/physics/physicsCollisionHandler.cxx b/panda/src/physics/physicsCollisionHandler.cxx index f3be69e927..7fe69cd997 100644 --- a/panda/src/physics/physicsCollisionHandler.cxx +++ b/panda/src/physics/physicsCollisionHandler.cxx @@ -20,6 +20,9 @@ #include "actorNode.h" #include "dcast.h" +using std::cerr; +using std::endl; + TypeHandle PhysicsCollisionHandler::_type_handle; /** diff --git a/panda/src/physics/physicsManager.cxx b/panda/src/physics/physicsManager.cxx index 510d61abce..3286e73539 100644 --- a/panda/src/physics/physicsManager.cxx +++ b/panda/src/physics/physicsManager.cxx @@ -17,6 +17,8 @@ #include #include "pvector.h" +using std::ostream; + ConfigVariableInt PhysicsManager::_random_seed ("physics_manager_random_seed", 139); diff --git a/panda/src/physics/physicsObject.cxx b/panda/src/physics/physicsObject.cxx index 96651949d5..79c1829374 100644 --- a/panda/src/physics/physicsObject.cxx +++ b/panda/src/physics/physicsObject.cxx @@ -150,7 +150,7 @@ get_inertial_tensor() const { * Write a string representation of this instance to . */ void PhysicsObject:: -output(ostream &out) const { +output(std::ostream &out) const { #ifndef NDEBUG //[ out<<"PhysicsObject"; #endif //] NDEBUG @@ -160,7 +160,7 @@ output(ostream &out) const { * Write a string representation of this instance to . */ void PhysicsObject:: -write(ostream &out, int indent) const { +write(std::ostream &out, int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""<<"PhysicsObject "<<_name<<"\n"; diff --git a/panda/src/physics/physicsObjectCollection.cxx b/panda/src/physics/physicsObjectCollection.cxx index 17ce51158d..2b810ef8be 100644 --- a/panda/src/physics/physicsObjectCollection.cxx +++ b/panda/src/physics/physicsObjectCollection.cxx @@ -221,7 +221,7 @@ size() const { * indicated output stream. */ void PhysicsObjectCollection:: -output(ostream &out) const { +output(std::ostream &out) const { if (get_num_physics_objects() == 1) { out << "1 PhysicsObject"; } else { @@ -234,7 +234,7 @@ output(ostream &out) const { * the indicated output stream. */ void PhysicsObjectCollection:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { for (int i = 0; i < get_num_physics_objects(); i++) { indent(out, indent_level) << get_physics_object(i) << "\n"; } diff --git a/panda/src/physics/test_physics.cxx b/panda/src/physics/test_physics.cxx index cb2e2f0c9d..21d248575f 100644 --- a/panda/src/physics/test_physics.cxx +++ b/panda/src/physics/test_physics.cxx @@ -16,6 +16,9 @@ #include "physicsManager.h" #include "forces.h" +using std::cout; +using std::endl; + class Baseball : public Physical { public: int ttl_balls; diff --git a/panda/src/physx/physxContactPair.cxx b/panda/src/physx/physxContactPair.cxx index 3e8d69e34f..fdaf22889c 100644 --- a/panda/src/physx/physxContactPair.cxx +++ b/panda/src/physx/physxContactPair.cxx @@ -25,7 +25,7 @@ PhysxActor *PhysxContactPair:: get_actor_a() const { if (_pair.isDeletedActor[0]) { - physx_cat.warning() << "actor A has been deleted" << endl; + physx_cat.warning() << "actor A has been deleted" << std::endl; return nullptr; } @@ -40,7 +40,7 @@ PhysxActor *PhysxContactPair:: get_actor_b() const { if (_pair.isDeletedActor[1]) { - physx_cat.warning() << "actor B has been deleted" << endl; + physx_cat.warning() << "actor B has been deleted" << std::endl; return nullptr; } diff --git a/panda/src/physx/physxDebugGeomNode.cxx b/panda/src/physx/physxDebugGeomNode.cxx index a609fb2f3c..8b3bd2a1ca 100644 --- a/panda/src/physx/physxDebugGeomNode.cxx +++ b/panda/src/physx/physxDebugGeomNode.cxx @@ -31,7 +31,7 @@ update(NxScene *scenePtr) { const NxDebugRenderable *renderable = scenePtr->getDebugRenderable(); if (!renderable) { remove_all_geoms(); - physx_cat.warning() << "Could no get debug renderable." << endl; + physx_cat.warning() << "Could no get debug renderable." << std::endl; return; } diff --git a/panda/src/physx/physxEnums.cxx b/panda/src/physx/physxEnums.cxx index 172e6013b3..73bf0a8534 100644 --- a/panda/src/physx/physxEnums.cxx +++ b/panda/src/physx/physxEnums.cxx @@ -16,8 +16,13 @@ #include "string_utils.h" #include "config_putil.h" +using std::istream; +using std::ostream; + ostream & operator << (ostream &out, PhysxEnums::PhysxUpAxis axis) { +std::ostream & +operator << (std::ostream &out, PhysxEnums::PhysxUpAxis axis) { switch (axis) { case PhysxEnums::X_up: @@ -36,7 +41,7 @@ operator << (ostream &out, PhysxEnums::PhysxUpAxis axis) { istream & operator >> (istream &in, PhysxEnums::PhysxUpAxis &axis) { - string word; + std::string word; in >> word; if (cmp_nocase(word, "x") == 0) { diff --git a/panda/src/physx/physxGroupsMask.cxx b/panda/src/physx/physxGroupsMask.cxx index e16497350e..6591ab2583 100644 --- a/panda/src/physx/physxGroupsMask.cxx +++ b/panda/src/physx/physxGroupsMask.cxx @@ -13,6 +13,8 @@ #include "physxGroupsMask.h" +using std::string; + /** * Returns a PhysxGroupsMask whose bits are all on. */ @@ -120,7 +122,7 @@ get_bit(unsigned int idx) const { * Writes the PhysxGroupsMask out as a list of ones and zeros. */ void PhysxGroupsMask:: -output(ostream &out) const { +output(std::ostream &out) const { string name0; string name1; diff --git a/panda/src/physx/physxLinearInterpolationValues.cxx b/panda/src/physx/physxLinearInterpolationValues.cxx index 346d30508f..45cd603c64 100644 --- a/panda/src/physx/physxLinearInterpolationValues.cxx +++ b/panda/src/physx/physxLinearInterpolationValues.cxx @@ -32,8 +32,8 @@ insert(float index, float value) { _min = _max = index; } else { - _min = min(_min, index); - _max = max(_max, index); + _min = std::min(_min, index); + _max = std::max(_max, index); } _map[index] = value; } @@ -106,11 +106,11 @@ get_value_at_index(int index) const { * */ void PhysxLinearInterpolationValues:: -output(ostream &out) const { +output(std::ostream &out) const { MapType::const_iterator it = _map.begin(); for (; it != _map.end(); ++it) { - cout << it->first << " -> " << it->second << "\n"; + std::cout << it->first << " -> " << it->second << "\n"; } } diff --git a/panda/src/physx/physxManager.cxx b/panda/src/physx/physxManager.cxx index 56f63149c8..1bba65c280 100644 --- a/panda/src/physx/physxManager.cxx +++ b/panda/src/physx/physxManager.cxx @@ -15,6 +15,8 @@ #include "physxScene.h" #include "physxSceneDesc.h" +using std::endl; + PhysxManager *PhysxManager::_global_ptr; PhysxManager::PhysxOutputStream PhysxManager::_outputStream; @@ -364,7 +366,7 @@ get_internal_version() { v = _sdk->getInternalVersion(apiRev, descRev, branchId); - stringstream version; + std::stringstream version; version << "version:" << (unsigned int)v << " apiRef:" << (unsigned int)apiRev << " descRev:" << (unsigned int)descRev diff --git a/panda/src/physx/physxMask.cxx b/panda/src/physx/physxMask.cxx index f1e31437ea..b9f3437634 100644 --- a/panda/src/physx/physxMask.cxx +++ b/panda/src/physx/physxMask.cxx @@ -70,9 +70,9 @@ get_bit(unsigned int idx) const { * Writes the PhysxMask out as a list of ones and zeros. */ void PhysxMask:: -output(ostream &out) const { +output(std::ostream &out) const { - string name; + std::string name; for (int i=0; i<32; i++) { name += (_mask & (1 << i)) ? '1' : '0'; diff --git a/panda/src/physx/physxMeshPool.cxx b/panda/src/physx/physxMeshPool.cxx index 4bf65576e2..155707cccb 100644 --- a/panda/src/physx/physxMeshPool.cxx +++ b/panda/src/physx/physxMeshPool.cxx @@ -32,12 +32,12 @@ bool PhysxMeshPool:: check_filename(const Filename &fn) { if (!(VirtualFileSystem::get_global_ptr()->exists(fn))) { - physx_cat.error() << "File does not exists: " << fn << endl; + physx_cat.error() << "File does not exists: " << fn << std::endl; return false; } if (!(VirtualFileSystem::get_global_ptr()->is_regular_file(fn))) { - physx_cat.error() << "Not a regular file: " << fn << endl; + physx_cat.error() << "Not a regular file: " << fn << std::endl; return false; } @@ -272,7 +272,7 @@ list_contents() { * */ void PhysxMeshPool:: -list_contents(ostream &out) { +list_contents(std::ostream &out) { out << "PhysX mesh pool contents:\n"; @@ -285,7 +285,7 @@ list_contents(ostream &out) { out << " " << fn.get_fullpath() << " (convex mesh, " << mesh->ptr()->getReferenceCount() - << " references)" << endl; + << " references)" << std::endl; } } diff --git a/panda/src/pipeline/conditionVarDebug.cxx b/panda/src/pipeline/conditionVarDebug.cxx index fb67e7d3c9..bbf9ce0d22 100644 --- a/panda/src/pipeline/conditionVarDebug.cxx +++ b/panda/src/pipeline/conditionVarDebug.cxx @@ -17,6 +17,9 @@ #ifdef DEBUG_THREADS +using std::ostream; +using std::ostringstream; + /** * You must pass in a Mutex to the condition variable constructor. This mutex * may be shared by other condition variables, if desired. It is the caller's diff --git a/panda/src/pipeline/conditionVarDirect.cxx b/panda/src/pipeline/conditionVarDirect.cxx index b3f18f1c0c..c9337e8d9c 100644 --- a/panda/src/pipeline/conditionVarDirect.cxx +++ b/panda/src/pipeline/conditionVarDirect.cxx @@ -20,7 +20,7 @@ * ConditionVarDirect. */ void ConditionVarDirect:: -output(ostream &out) const { +output(std::ostream &out) const { out << "ConditionVar " << (void *)this << " on " << _mutex; } diff --git a/panda/src/pipeline/conditionVarFullDebug.cxx b/panda/src/pipeline/conditionVarFullDebug.cxx index 24f9d1cdc3..746991e79c 100644 --- a/panda/src/pipeline/conditionVarFullDebug.cxx +++ b/panda/src/pipeline/conditionVarFullDebug.cxx @@ -17,6 +17,9 @@ #ifdef DEBUG_THREADS +using std::ostream; +using std::ostringstream; + /** * You must pass in a Mutex to the condition variable constructor. This mutex * may be shared by other condition variables, if desired. It is the caller's diff --git a/panda/src/pipeline/conditionVarFullDirect.cxx b/panda/src/pipeline/conditionVarFullDirect.cxx index 10c30d57c9..04f9c647ed 100644 --- a/panda/src/pipeline/conditionVarFullDirect.cxx +++ b/panda/src/pipeline/conditionVarFullDirect.cxx @@ -20,7 +20,7 @@ * in ConditionVarFullDirect. */ void ConditionVarFullDirect:: -output(ostream &out) const { +output(std::ostream &out) const { out << "ConditionVarFull " << (void *)this << " on " << _mutex; } diff --git a/panda/src/pipeline/cycleData.cxx b/panda/src/pipeline/cycleData.cxx index 7570aabbf8..62359cd451 100644 --- a/panda/src/pipeline/cycleData.cxx +++ b/panda/src/pipeline/cycleData.cxx @@ -79,6 +79,6 @@ get_parent_type() const { * This is useful mainly for debugging. */ void CycleData:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_parent_type() << "::CData"; } diff --git a/panda/src/pipeline/externalThread.cxx b/panda/src/pipeline/externalThread.cxx index 411c4f2062..d77fc194ea 100644 --- a/panda/src/pipeline/externalThread.cxx +++ b/panda/src/pipeline/externalThread.cxx @@ -31,7 +31,7 @@ ExternalThread() : Thread("External", "External") { * external thread that is bound via Thread::bind_thread(). */ ExternalThread:: -ExternalThread(const string &name, const string &sync_name) : +ExternalThread(const std::string &name, const std::string &sync_name) : Thread(name, sync_name) { _started = true; diff --git a/panda/src/pipeline/genericThread.cxx b/panda/src/pipeline/genericThread.cxx index b91819f61f..64eb0b4814 100644 --- a/panda/src/pipeline/genericThread.cxx +++ b/panda/src/pipeline/genericThread.cxx @@ -20,7 +20,7 @@ TypeHandle GenericThread::_type_handle; * */ GenericThread:: -GenericThread(const string &name, const string &sync_name) : +GenericThread(const std::string &name, const std::string &sync_name) : Thread(name, sync_name) { _function = nullptr; @@ -31,7 +31,7 @@ GenericThread(const string &name, const string &sync_name) : * */ GenericThread:: -GenericThread(const string &name, const string &sync_name, GenericThread::ThreadFunc *function, void *user_data) : +GenericThread(const std::string &name, const std::string &sync_name, GenericThread::ThreadFunc *function, void *user_data) : Thread(name, sync_name), _function(function), _user_data(user_data) diff --git a/panda/src/pipeline/lightMutexDirect.cxx b/panda/src/pipeline/lightMutexDirect.cxx index ed5d1a30ff..522d361032 100644 --- a/panda/src/pipeline/lightMutexDirect.cxx +++ b/panda/src/pipeline/lightMutexDirect.cxx @@ -20,7 +20,7 @@ * LightMutexDirect. */ void LightMutexDirect:: -output(ostream &out) const { +output(std::ostream &out) const { out << "LightMutex " << (void *)this; } diff --git a/panda/src/pipeline/lightReMutexDirect.cxx b/panda/src/pipeline/lightReMutexDirect.cxx index fdfcc71cd2..9166f87867 100644 --- a/panda/src/pipeline/lightReMutexDirect.cxx +++ b/panda/src/pipeline/lightReMutexDirect.cxx @@ -21,7 +21,7 @@ * LightReMutexDirect. */ void LightReMutexDirect:: -output(ostream &out) const { +output(std::ostream &out) const { out << "LightReMutex " << (void *)this; } diff --git a/panda/src/pipeline/mutexDebug.cxx b/panda/src/pipeline/mutexDebug.cxx index a73e1257bc..d1e0194e6f 100644 --- a/panda/src/pipeline/mutexDebug.cxx +++ b/panda/src/pipeline/mutexDebug.cxx @@ -17,6 +17,9 @@ #ifdef DEBUG_THREADS +using std::ostream; +using std::ostringstream; + int MutexDebug::_pstats_count = 0; MutexTrueImpl *MutexDebug::_global_lock; @@ -24,7 +27,7 @@ MutexTrueImpl *MutexDebug::_global_lock; * */ MutexDebug:: -MutexDebug(const string &name, bool allow_recursion, bool lightweight) : +MutexDebug(const std::string &name, bool allow_recursion, bool lightweight) : Namable(name), _allow_recursion(allow_recursion), _lightweight(lightweight), @@ -53,7 +56,7 @@ MutexDebug:: if (name_deleted_mutexes) { ostringstream strm; strm << *this; - string name = strm.str(); + std::string name = strm.str(); _deleted_name = strdup((char *)name.c_str()); } diff --git a/panda/src/pipeline/mutexDirect.cxx b/panda/src/pipeline/mutexDirect.cxx index 5f74c67c93..29c0beb9b4 100644 --- a/panda/src/pipeline/mutexDirect.cxx +++ b/panda/src/pipeline/mutexDirect.cxx @@ -20,7 +20,7 @@ * MutexDirect. */ void MutexDirect:: -output(ostream &out) const { +output(std::ostream &out) const { out << "Mutex " << (void *)this; } diff --git a/panda/src/pipeline/pipeline.cxx b/panda/src/pipeline/pipeline.cxx index c12e72114b..763dc3a8d6 100644 --- a/panda/src/pipeline/pipeline.cxx +++ b/panda/src/pipeline/pipeline.cxx @@ -22,7 +22,7 @@ Pipeline *Pipeline::_render_pipeline = nullptr; * */ Pipeline:: -Pipeline(const string &name, int num_stages) : +Pipeline(const std::string &name, int num_stages) : Namable(name), #ifdef THREADED_PIPELINE _num_stages(num_stages), diff --git a/panda/src/pipeline/pipelineCyclerTrueImpl.cxx b/panda/src/pipeline/pipelineCyclerTrueImpl.cxx index fb31088501..714e61c0e4 100644 --- a/panda/src/pipeline/pipelineCyclerTrueImpl.cxx +++ b/panda/src/pipeline/pipelineCyclerTrueImpl.cxx @@ -324,7 +324,7 @@ set_num_stages(int num_stages) { * */ void PipelineCyclerTrueImpl::CyclerMutex:: -output(ostream &out) const { +output(std::ostream &out) const { out << "CyclerMutex "; _cycler->cheat()->output(out); } diff --git a/panda/src/pipeline/psemaphore.cxx b/panda/src/pipeline/psemaphore.cxx index 1142930e3a..9a1e453819 100644 --- a/panda/src/pipeline/psemaphore.cxx +++ b/panda/src/pipeline/psemaphore.cxx @@ -17,7 +17,7 @@ * */ void Semaphore:: -output(ostream &out) const { +output(std::ostream &out) const { MutexHolder holder(_lock); out << "Semaphore, count = " << _count; } diff --git a/panda/src/pipeline/pythonThread.cxx b/panda/src/pipeline/pythonThread.cxx index ae64aba2a4..ab41070fb8 100644 --- a/panda/src/pipeline/pythonThread.cxx +++ b/panda/src/pipeline/pythonThread.cxx @@ -24,7 +24,7 @@ TypeHandle PythonThread::_type_handle; */ PythonThread:: PythonThread(PyObject *function, PyObject *args, - const string &name, const string &sync_name) : + const std::string &name, const std::string &sync_name) : Thread(name, sync_name) { _function = function; diff --git a/panda/src/pipeline/reMutexDirect.cxx b/panda/src/pipeline/reMutexDirect.cxx index b83a2f30a6..7bfdcb8f8d 100644 --- a/panda/src/pipeline/reMutexDirect.cxx +++ b/panda/src/pipeline/reMutexDirect.cxx @@ -21,7 +21,7 @@ * ReMutexDirect. */ void ReMutexDirect:: -output(ostream &out) const { +output(std::ostream &out) const { out << "ReMutex " << (void *)this; } @@ -146,7 +146,7 @@ do_unlock() { #ifdef _DEBUG if (_locking_thread != Thread::get_current_thread()) { - ostringstream ostr; + std::ostringstream ostr; ostr << *_locking_thread << " attempted to release " << *this << " which it does not own"; nassert_raise(ostr.str()); diff --git a/panda/src/pipeline/test_atomic.cxx b/panda/src/pipeline/test_atomic.cxx index ae371114e4..66ab6c5a14 100644 --- a/panda/src/pipeline/test_atomic.cxx +++ b/panda/src/pipeline/test_atomic.cxx @@ -35,7 +35,7 @@ AtomicAdjust::Integer _num_net_count_incremented = 0; class MyThread : public Thread { public: - MyThread(const string &name) : Thread(name, name) + MyThread(const std::string &name) : Thread(name, name) { } @@ -73,7 +73,7 @@ main(int argc, char *argv[]) { for (int i = 1; i < number_of_threads; ++i) { char name = 'a' + i; - PT(MyThread) thread = new MyThread(string(1, name)); + PT(MyThread) thread = new MyThread(std::string(1, name)); threads.push_back(thread); thread->start(TP_normal, true); } diff --git a/panda/src/pipeline/test_concurrency.cxx b/panda/src/pipeline/test_concurrency.cxx index 9d092d08c8..6f59a025b1 100644 --- a/panda/src/pipeline/test_concurrency.cxx +++ b/panda/src/pipeline/test_concurrency.cxx @@ -50,7 +50,7 @@ volatile MemBlock memblock[number_of_threads]; class MyThread : public Thread { public: - MyThread(const string &name, int index) : + MyThread(const std::string &name, int index) : Thread(name, name), _index(index) { @@ -101,7 +101,7 @@ main(int argc, char *argv[]) { for (int i = 1; i < number_of_threads; ++i) { char name = 'a' + i; Thread::sleep(delay_between_threads); - PT(MyThread) thread = new MyThread(string(1, name), i); + PT(MyThread) thread = new MyThread(std::string(1, name), i); threads.push_back(thread); thread->start(TP_normal, true); } diff --git a/panda/src/pipeline/test_delete.cxx b/panda/src/pipeline/test_delete.cxx index f49606a6f1..3ea431f77b 100644 --- a/panda/src/pipeline/test_delete.cxx +++ b/panda/src/pipeline/test_delete.cxx @@ -80,7 +80,7 @@ TypeHandle Doober::_type_handle; class MyThread : public Thread { public: - MyThread(const string &name) : Thread(name, name) + MyThread(const std::string &name) : Thread(name, name) { } @@ -106,7 +106,7 @@ public: doobers.push_back(new Doober(++counter)); } int num_del = (int)random_f(max_doobers_per_chunk); - num_del = min(num_del, (int)doobers.size()); + num_del = std::min(num_del, (int)doobers.size()); for (int j = 0; j < num_del; ++j) { assert(!doobers.empty()); @@ -137,7 +137,7 @@ main(int argc, char *argv[]) { for (int i = 1; i < number_of_threads; ++i) { char name = 'a' + i; - PT(MyThread) thread = new MyThread(string(1, name)); + PT(MyThread) thread = new MyThread(std::string(1, name)); threads.push_back(thread); thread->start(TP_normal, true); } diff --git a/panda/src/pipeline/test_diners.cxx b/panda/src/pipeline/test_diners.cxx index 27976e3ea5..a5ff82e446 100644 --- a/panda/src/pipeline/test_diners.cxx +++ b/panda/src/pipeline/test_diners.cxx @@ -24,6 +24,8 @@ #include "trueClock.h" #include "pstrtod.h" +using std::cerr; + #ifdef WIN32_VC // Under Windows, the rand() function seems to return a sequence per-thread, // so we use this trick to set each thread to a different seed. @@ -50,7 +52,7 @@ static double random_f(double max) class ChopstickMutex : public Mutex { public: - void output(ostream &out) const { + void output(std::ostream &out) const { out << "chopstick " << _n; } int _n; @@ -121,7 +123,7 @@ public: _id = id; } - virtual void output(ostream &out) const { + virtual void output(std::ostream &out) const { out << "philosopher " << _id; } }; diff --git a/panda/src/pipeline/test_mutex.cxx b/panda/src/pipeline/test_mutex.cxx index f02ccd1434..a0a4dd49c6 100644 --- a/panda/src/pipeline/test_mutex.cxx +++ b/panda/src/pipeline/test_mutex.cxx @@ -22,7 +22,7 @@ static const double thread_duration = 5.0; class MyThread : public Thread { public: - MyThread(const string &name, MutexImpl &m1, double period) : + MyThread(const std::string &name, MutexImpl &m1, double period) : Thread(name, name), _m1(m1), _period(period) { @@ -50,11 +50,11 @@ main(int argc, char *argv[]) { _m1.lock(); _m1.unlock(); - cerr << "Making threads.\n"; + std::cerr << "Making threads.\n"; MyThread *a = new MyThread("a", _m1, 1.0); MyThread *b = new MyThread("b", _m1, 0.9); - cerr << "Starting threads.\n"; + std::cerr << "Starting threads.\n"; a->start(TP_normal, true); b->start(TP_normal, true); diff --git a/panda/src/pipeline/test_setjmp.cxx b/panda/src/pipeline/test_setjmp.cxx index 3ce1bcf075..4803ff3fee 100644 --- a/panda/src/pipeline/test_setjmp.cxx +++ b/panda/src/pipeline/test_setjmp.cxx @@ -15,6 +15,8 @@ #include +using std::cerr; + int main(int argc, char *argv[]) { diff --git a/panda/src/pipeline/test_threaddata.cxx b/panda/src/pipeline/test_threaddata.cxx index 2e347823c9..b3d919a827 100644 --- a/panda/src/pipeline/test_threaddata.cxx +++ b/panda/src/pipeline/test_threaddata.cxx @@ -17,12 +17,14 @@ #include "mutexHolder.h" #include "pointerTo.h" +using std::cout; + Mutex *cout_mutex = nullptr; // Test forking a thread with some private data. class ThreadWithData : public Thread { public: - ThreadWithData(const string &name, int parameter); + ThreadWithData(const std::string &name, int parameter); virtual void thread_main(); @@ -32,7 +34,7 @@ private: ThreadWithData:: -ThreadWithData(const string &name, int parameter) : +ThreadWithData(const std::string &name, int parameter) : Thread(name, name), _parameter(parameter) { @@ -60,7 +62,7 @@ int main() { cout << "main beginning.\n"; for (int i = 0; i < 10; i++) { - string name = string("thread_") + (char)(i + 'a'); + std::string name = std::string("thread_") + (char)(i + 'a'); PT(Thread) thread = new ThreadWithData(name, i); if (!thread->start(TP_low, true)) { MutexHolder holder(cout_mutex); diff --git a/panda/src/pipeline/thread.cxx b/panda/src/pipeline/thread.cxx index 3dc5994282..351e316033 100644 --- a/panda/src/pipeline/thread.cxx +++ b/panda/src/pipeline/thread.cxx @@ -36,7 +36,7 @@ TypeHandle Thread::_type_handle; * given the same sync_name, for the benefit of PStats. */ Thread:: -Thread(const string &name, const string &sync_name) : +Thread(const std::string &name, const std::string &sync_name) : Namable(name), _sync_name(sync_name), _impl(this) @@ -87,7 +87,7 @@ Thread:: * case the same pointer will be returned each time). */ PT(Thread) Thread:: -bind_thread(const string &name, const string &sync_name) { +bind_thread(const std::string &name, const std::string &sync_name) { Thread *current_thread = get_current_thread(); if (current_thread != get_external_thread()) { // This thread already has an associated thread. @@ -129,7 +129,7 @@ set_pipeline_stage(int pipeline_stage) { * */ void Thread:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type() << " " << get_name(); } @@ -139,7 +139,7 @@ output(ostream &out) const { * DEBUG_THREADS mode. */ void Thread:: -output_blocker(ostream &out) const { +output_blocker(std::ostream &out) const { #ifdef DEBUG_THREADS if (_blocked_on_mutex != nullptr) { _blocked_on_mutex->output_with_holder(out); @@ -155,7 +155,7 @@ output_blocker(ostream &out) const { * */ void Thread:: -write_status(ostream &out) { +write_status(std::ostream &out) { #if defined(HAVE_THREADS) && defined(SIMPLE_THREADS) ThreadImpl::write_status(out); #endif diff --git a/panda/src/pipeline/threadDummyImpl.cxx b/panda/src/pipeline/threadDummyImpl.cxx index 419744a4b5..2d30630d98 100644 --- a/panda/src/pipeline/threadDummyImpl.cxx +++ b/panda/src/pipeline/threadDummyImpl.cxx @@ -28,10 +28,10 @@ /** * */ -string ThreadDummyImpl:: +std::string ThreadDummyImpl:: get_unique_id() const { // In a single-threaded application, this is just the unique process ID. - ostringstream strm; + std::ostringstream strm; #ifdef WIN32 strm << GetCurrentProcessId(); #else diff --git a/panda/src/pipeline/threadPosixImpl.cxx b/panda/src/pipeline/threadPosixImpl.cxx index dcae44e721..0d88c5ebe8 100644 --- a/panda/src/pipeline/threadPosixImpl.cxx +++ b/panda/src/pipeline/threadPosixImpl.cxx @@ -177,9 +177,9 @@ join() { /** * */ -string ThreadPosixImpl:: +std::string ThreadPosixImpl:: get_unique_id() const { - ostringstream strm; + std::ostringstream strm; strm << getpid() << "." << _thread; return strm.str(); @@ -193,7 +193,7 @@ get_unique_id() const { bool ThreadPosixImpl:: attach_java_vm() { JNIEnv *env; - string thread_name = _parent_obj->get_name(); + std::string thread_name = _parent_obj->get_name(); JavaVMAttachArgs args; args.version = JNI_VERSION_1_2; args.name = thread_name.c_str(); diff --git a/panda/src/pipeline/threadPriority.cxx b/panda/src/pipeline/threadPriority.cxx index 0402273099..3d9c55fe21 100644 --- a/panda/src/pipeline/threadPriority.cxx +++ b/panda/src/pipeline/threadPriority.cxx @@ -15,6 +15,10 @@ #include "pnotify.h" // nassertr #include "pipeline.h" +using std::istream; +using std::ostream; +using std::string; + ostream & operator << (ostream &out, ThreadPriority pri) { switch (pri) { diff --git a/panda/src/pipeline/threadSimpleImpl.cxx b/panda/src/pipeline/threadSimpleImpl.cxx index 1bde4c7ca0..a631421503 100644 --- a/panda/src/pipeline/threadSimpleImpl.cxx +++ b/panda/src/pipeline/threadSimpleImpl.cxx @@ -178,9 +178,9 @@ preempt() { /** * */ -string ThreadSimpleImpl:: +std::string ThreadSimpleImpl:: get_unique_id() const { - ostringstream strm; + std::ostringstream strm; #ifdef WIN32 strm << GetCurrentProcessId(); #else diff --git a/panda/src/pipeline/threadSimpleManager.cxx b/panda/src/pipeline/threadSimpleManager.cxx index 8b58579642..4d9890dfd4 100644 --- a/panda/src/pipeline/threadSimpleManager.cxx +++ b/panda/src/pipeline/threadSimpleManager.cxx @@ -377,7 +377,7 @@ system_sleep(double seconds) { * Writes a list of threads running and threads blocked. */ void ThreadSimpleManager:: -write_status(ostream &out) const { +write_status(std::ostream &out) const { out << "Currently running: " << *_current_thread->_parent_obj << "\n"; out << "Ready:"; @@ -663,7 +663,7 @@ do_timeslice_accounting(ThreadSimpleImpl *thread, double now) { // Clamp the elapsed time at 0. (If it's less than 0, the clock is running // backwards, ick.) - elapsed = max(elapsed, 0.0); + elapsed = std::max(elapsed, 0.0); unsigned int ticks = (unsigned int)(elapsed * _tick_scale + 0.5); thread->_run_ticks += ticks; diff --git a/panda/src/pipeline/threadWin32Impl.cxx b/panda/src/pipeline/threadWin32Impl.cxx index 998dc44b8c..4671787918 100644 --- a/panda/src/pipeline/threadWin32Impl.cxx +++ b/panda/src/pipeline/threadWin32Impl.cxx @@ -125,9 +125,9 @@ join() { /** * */ -string ThreadWin32Impl:: +std::string ThreadWin32Impl:: get_unique_id() const { - ostringstream strm; + std::ostringstream strm; strm << GetCurrentProcessId() << "." << _thread_id; return strm.str(); diff --git a/panda/src/pnmimage/pfmFile.cxx b/panda/src/pnmimage/pfmFile.cxx index 97a151f324..abe2845add 100644 --- a/panda/src/pnmimage/pfmFile.cxx +++ b/panda/src/pnmimage/pfmFile.cxx @@ -24,6 +24,11 @@ #include "string_utils.h" #include "look_at.h" +using std::istream; +using std::max; +using std::min; +using std::ostream; + /** * */ diff --git a/panda/src/pnmimage/pnm-image-filter.cxx b/panda/src/pnmimage/pnm-image-filter.cxx index 63398ad3c1..6ca6a145d6 100644 --- a/panda/src/pnmimage/pnm-image-filter.cxx +++ b/panda/src/pnmimage/pnm-image-filter.cxx @@ -37,6 +37,9 @@ #include "pnmImage.h" #include "pfmFile.h" +using std::max; +using std::min; + // WorkType is an abstraction that allows the filtering process to be // recompiled to use either floating-point or integer arithmetic. On SGI // machines, there doesn't seem to be much of a performance difference-- if diff --git a/panda/src/pnmimage/pnmBrush.cxx b/panda/src/pnmimage/pnmBrush.cxx index 64dffab3cb..94d1799fe7 100644 --- a/panda/src/pnmimage/pnmBrush.cxx +++ b/panda/src/pnmimage/pnmBrush.cxx @@ -16,6 +16,9 @@ #include "config_pnmimage.h" #include "cmath.h" +using std::max; +using std::min; + // A PNMTransparentBrush doesn't draw or fill anything. class EXPCL_PANDA_PNMIMAGE PNMTransparentBrush : public PNMBrush { public: diff --git a/panda/src/pnmimage/pnmFileType.cxx b/panda/src/pnmimage/pnmFileType.cxx index 80fae2784a..c400db9d53 100644 --- a/panda/src/pnmimage/pnmFileType.cxx +++ b/panda/src/pnmimage/pnmFileType.cxx @@ -18,6 +18,8 @@ #include "bamReader.h" #include "bamWriter.h" +using std::string; + bool PNMFileType::_did_init_pnm = false; TypeHandle PNMFileType::_type_handle; @@ -91,7 +93,7 @@ matches_magic_number(const string &) const { * returns NULL. */ PNMReader *PNMFileType:: -make_reader(istream *, bool, const string &) { +make_reader(std::istream *, bool, const string &) { return nullptr; } @@ -101,7 +103,7 @@ make_reader(istream *, bool, const string &) { * NULL. */ PNMWriter *PNMFileType:: -make_writer(ostream *, bool) { +make_writer(std::ostream *, bool) { return nullptr; } diff --git a/panda/src/pnmimage/pnmFileTypeRegistry.cxx b/panda/src/pnmimage/pnmFileTypeRegistry.cxx index c1dd16f211..d290f52bdc 100644 --- a/panda/src/pnmimage/pnmFileTypeRegistry.cxx +++ b/panda/src/pnmimage/pnmFileTypeRegistry.cxx @@ -21,6 +21,8 @@ #include +using std::string; + PNMFileTypeRegistry *PNMFileTypeRegistry::_global_ptr; /** @@ -243,7 +245,7 @@ get_type_by_handle(TypeHandle handle) const { * one per line. */ void PNMFileTypeRegistry:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { if (_types.empty()) { indent(out, indent_level) << "(No image types are known).\n"; } else { @@ -252,7 +254,7 @@ write(ostream &out, int indent_level) const { PNMFileType *type = (*ti); string name = type->get_name(); indent(out, indent_level) << name; - indent(out, max(30 - (int)name.length(), 0)) << " "; + indent(out, std::max(30 - (int)name.length(), 0)) << " "; int num_extensions = type->get_num_extensions(); if (num_extensions == 1) { diff --git a/panda/src/pnmimage/pnmImage.cxx b/panda/src/pnmimage/pnmImage.cxx index ce9871d6f0..9c6c3a68d9 100644 --- a/panda/src/pnmimage/pnmImage.cxx +++ b/panda/src/pnmimage/pnmImage.cxx @@ -21,6 +21,9 @@ #include "stackedPerlinNoise2.h" #include +using std::max; +using std::min; + /** * */ @@ -295,10 +298,10 @@ read(const Filename &filename, PNMFileType *type, bool report_unknown_type) { * Returns true if successful, false on error. */ bool PNMImage:: -read(istream &data, const string &filename, PNMFileType *type, +read(std::istream &data, const std::string &filename, PNMFileType *type, bool report_unknown_type) { PNMReader *reader = PNMImageHeader::make_reader - (&data, false, filename, string(), type, report_unknown_type); + (&data, false, filename, std::string(), type, report_unknown_type); if (reader == nullptr) { clear(); return false; @@ -402,7 +405,7 @@ write(const Filename &filename, PNMFileType *type) const { * write. */ bool PNMImage:: -write(ostream &data, const string &filename, PNMFileType *type) const { +write(std::ostream &data, const std::string &filename, PNMFileType *type) const { if (!is_valid()) { return false; } diff --git a/panda/src/pnmimage/pnmImageHeader.cxx b/panda/src/pnmimage/pnmImageHeader.cxx index b51e2d8c4d..c7a6129bd7 100644 --- a/panda/src/pnmimage/pnmImageHeader.cxx +++ b/panda/src/pnmimage/pnmImageHeader.cxx @@ -20,6 +20,10 @@ #include "virtualFileSystem.h" #include "zStream.h" +using std::istream; +using std::ostream; +using std::string; + /** * Opens up the image file and tries to read its header information to * determine its size, number of channels, etc. If successful, updates the @@ -84,7 +88,7 @@ make_reader(const Filename &filename, PNMFileType *type, if (filename == "-") { owns_file = false; - file = &cin; + file = &std::cin; if (pnmimage_cat.is_debug()) { pnmimage_cat.debug() @@ -251,7 +255,7 @@ make_writer(const Filename &filename, PNMFileType *type) const { if (filename == "-") { owns_file = false; - file = &cout; + file = &std::cout; if (pnmimage_cat.is_debug()) { pnmimage_cat.debug() diff --git a/panda/src/pnmimage/pnmReader.cxx b/panda/src/pnmimage/pnmReader.cxx index b40bf3ce40..938648e0a1 100644 --- a/panda/src/pnmimage/pnmReader.cxx +++ b/panda/src/pnmimage/pnmReader.cxx @@ -249,7 +249,7 @@ get_reduction_shift(int orig_size, int new_size) { return 0; } - int reduction = max(orig_size / new_size, 1); + int reduction = std::max(orig_size / new_size, 1); int shift = 0; diff --git a/panda/src/pnmimage/pnmbitio.cxx b/panda/src/pnmimage/pnmbitio.cxx index 2dcbfbfacc..fbd9bff5d4 100644 --- a/panda/src/pnmimage/pnmbitio.cxx +++ b/panda/src/pnmimage/pnmbitio.cxx @@ -15,6 +15,10 @@ #include "pnmbitio.h" #include + +using std::istream; +using std::ostream; + struct bitstream { istream *inf; diff --git a/panda/src/pnmimage/pnmimage_base.cxx b/panda/src/pnmimage/pnmimage_base.cxx index 075b45dcd2..0fb9bedfc6 100644 --- a/panda/src/pnmimage/pnmimage_base.cxx +++ b/panda/src/pnmimage/pnmimage_base.cxx @@ -19,6 +19,9 @@ #include #include // for sprintf() +using std::istream; +using std::ostream; + /** * Outputs the given printf-style message to the user and returns. diff --git a/panda/src/pnmimagetypes/config_pnmimagetypes.cxx b/panda/src/pnmimagetypes/config_pnmimagetypes.cxx index 7661696980..551c351c43 100644 --- a/panda/src/pnmimagetypes/config_pnmimagetypes.cxx +++ b/panda/src/pnmimagetypes/config_pnmimagetypes.cxx @@ -36,6 +36,10 @@ #error Buildsystem error: BUILDING_PANDA_PNMIMAGETYPES not defined #endif +using std::istream; +using std::ostream; +using std::string; + Configure(config_pnmimagetypes); NotifyCategoryDefName(pnmimage_sgi, "sgi", pnmimage_cat); NotifyCategoryDefName(pnmimage_tga, "tga", pnmimage_cat); diff --git a/panda/src/pnmimagetypes/pnmFileTypeBMP.cxx b/panda/src/pnmimagetypes/pnmFileTypeBMP.cxx index 9ff4240ecf..688275edf7 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeBMP.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeBMP.cxx @@ -20,6 +20,8 @@ #include "pnmFileTypeRegistry.h" #include "bamReader.h" +using std::string; + static const char * const extensions_bmp[] = { "bmp" }; @@ -96,7 +98,7 @@ matches_magic_number(const string &magic_number) const { * returns NULL. */ PNMReader *PNMFileTypeBMP:: -make_reader(istream *file, bool owns_file, const string &magic_number) { +make_reader(std::istream *file, bool owns_file, const string &magic_number) { init_pnm(); return new Reader(this, file, owns_file, magic_number); } @@ -107,7 +109,7 @@ make_reader(istream *file, bool owns_file, const string &magic_number) { * NULL. */ PNMWriter *PNMFileTypeBMP:: -make_writer(ostream *file, bool owns_file) { +make_writer(std::ostream *file, bool owns_file) { init_pnm(); return new Writer(this, file, owns_file); } diff --git a/panda/src/pnmimagetypes/pnmFileTypeBMPReader.cxx b/panda/src/pnmimagetypes/pnmFileTypeBMPReader.cxx index 394445f257..7b2fc6e18c 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeBMPReader.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeBMPReader.cxx @@ -19,6 +19,9 @@ #include "bmp.h" #include "pnmbitio.h" +using std::istream; +using std::string; + // Much code in this file is borrowed from Netpbm, specifically bmptoppm.c. /* * bmptoppm.c - Converts from a Microsoft Windows or OS/2 .BMP file to a diff --git a/panda/src/pnmimagetypes/pnmFileTypeBMPWriter.cxx b/panda/src/pnmimagetypes/pnmFileTypeBMPWriter.cxx index b624314b6b..2c592afa9d 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeBMPWriter.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeBMPWriter.cxx @@ -45,6 +45,8 @@ #define MAXCOLORS 256 +using std::ostream; + /* * Utilities */ diff --git a/panda/src/pnmimagetypes/pnmFileTypeEXR.cxx b/panda/src/pnmimagetypes/pnmFileTypeEXR.cxx index 157bd716be..83d7cf5bb4 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeEXR.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeEXR.cxx @@ -30,6 +30,10 @@ #define IMATH_NAMESPACE Imath #endif +using std::istream; +using std::ostream; +using std::string; + TypeHandle PNMFileTypeEXR::_type_handle; static const char * const extensions_exr[] = { diff --git a/panda/src/pnmimagetypes/pnmFileTypeIMG.cxx b/panda/src/pnmimagetypes/pnmFileTypeIMG.cxx index 477f921bd2..3e20f41a87 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeIMG.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeIMG.cxx @@ -25,6 +25,10 @@ // than this, it must be bogus. #define INSANE_SIZE 20000 +using std::istream; +using std::ostream; +using std::string; + static const char * const extensions_img[] = { "img" }; diff --git a/panda/src/pnmimagetypes/pnmFileTypeJPG.cxx b/panda/src/pnmimagetypes/pnmFileTypeJPG.cxx index 555fe29074..d7793be7fe 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeJPG.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeJPG.cxx @@ -20,6 +20,8 @@ #include "pnmFileTypeRegistry.h" #include "bamReader.h" +using std::string; + static const char *const extensions_jpg[] = { "jpg", "jpeg" }; @@ -97,7 +99,7 @@ matches_magic_number(const string &magic_number) const { * returns NULL. */ PNMReader *PNMFileTypeJPG:: -make_reader(istream *file, bool owns_file, const string &magic_number) { +make_reader(std::istream *file, bool owns_file, const string &magic_number) { init_pnm(); return new Reader(this, file, owns_file, magic_number); } @@ -108,7 +110,7 @@ make_reader(istream *file, bool owns_file, const string &magic_number) { * NULL. */ PNMWriter *PNMFileTypeJPG:: -make_writer(ostream *file, bool owns_file) { +make_writer(std::ostream *file, bool owns_file) { init_pnm(); return new Writer(this, file, owns_file); } diff --git a/panda/src/pnmimagetypes/pnmFileTypeJPGReader.cxx b/panda/src/pnmimagetypes/pnmFileTypeJPGReader.cxx index 4525dda22a..2789583e7f 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeJPGReader.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeJPGReader.cxx @@ -49,7 +49,7 @@ extern "C" { typedef struct { struct jpeg_source_mgr pub; /* public fields */ - istream * infile; /* source stream */ + std::istream * infile; /* source stream */ JOCTET * buffer; /* start of buffer */ boolean start_of_file; /* have we gotten any data yet? */ } my_source_mgr; @@ -205,7 +205,7 @@ term_source (j_decompress_ptr cinfo) */ GLOBAL(void) -jpeg_istream_src (j_decompress_ptr cinfo, istream * infile) +jpeg_istream_src (j_decompress_ptr cinfo, std::istream * infile) { my_src_ptr src; @@ -245,11 +245,11 @@ jpeg_istream_src (j_decompress_ptr cinfo, istream * infile) * */ PNMFileTypeJPG::Reader:: -Reader(PNMFileType *type, istream *file, bool owns_file, string magic_number) : +Reader(PNMFileType *type, std::istream *file, bool owns_file, std::string magic_number) : PNMReader(type, file, owns_file) { // Hope we can putback() more than one character. - for (string::reverse_iterator mi = magic_number.rbegin(); + for (std::string::reverse_iterator mi = magic_number.rbegin(); mi != magic_number.rend(); ++mi) { _file->putback(*mi); @@ -308,7 +308,7 @@ prepare_read() { // Attempt to get the scale close to our target scale. int x_reduction = _cinfo.image_width / _read_x_size; int y_reduction = _cinfo.image_height / _read_y_size; - _cinfo.scale_denom = max(min(x_reduction, y_reduction), 1); + _cinfo.scale_denom = std::max(std::min(x_reduction, y_reduction), 1); } /* Step 7: Start decompressor */ @@ -413,7 +413,7 @@ read_data(xel *array, xelval *) { */ if (_jerr.pub.num_warnings) { pnmimage_jpg_cat.warning() - << "Jpeg data may be corrupt" << endl; + << "Jpeg data may be corrupt" << std::endl; } return _y_size; diff --git a/panda/src/pnmimagetypes/pnmFileTypeJPGWriter.cxx b/panda/src/pnmimagetypes/pnmFileTypeJPGWriter.cxx index 5308a3417e..6f0285a841 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeJPGWriter.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeJPGWriter.cxx @@ -53,7 +53,7 @@ extern "C" { typedef struct { struct jpeg_destination_mgr pub; /* public fields */ - ostream * outfile; /* target stream */ + std::ostream * outfile; /* target stream */ JOCTET * buffer; /* start of buffer */ } my_destination_mgr; @@ -156,7 +156,7 @@ term_destination (j_compress_ptr cinfo) */ GLOBAL(void) -jpeg_ostream_dest (j_compress_ptr cinfo, ostream * outfile) +jpeg_ostream_dest (j_compress_ptr cinfo, std::ostream * outfile) { my_dest_ptr dest; @@ -187,7 +187,7 @@ jpeg_ostream_dest (j_compress_ptr cinfo, ostream * outfile) * */ PNMFileTypeJPG::Writer:: -Writer(PNMFileType *type, ostream *file, bool owns_file) : +Writer(PNMFileType *type, std::ostream *file, bool owns_file) : PNMWriter(type, file, owns_file) { } diff --git a/panda/src/pnmimagetypes/pnmFileTypePNG.cxx b/panda/src/pnmimagetypes/pnmFileTypePNG.cxx index 3c2bb2b1d0..799f4d1dce 100644 --- a/panda/src/pnmimagetypes/pnmFileTypePNG.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypePNG.cxx @@ -21,6 +21,10 @@ #include "bamReader.h" #include "thread.h" +using std::istream; +using std::ostream; +using std::string; + static const char * const extensions_png[] = { "png" }; diff --git a/panda/src/pnmimagetypes/pnmFileTypePNM.cxx b/panda/src/pnmimagetypes/pnmFileTypePNM.cxx index 7fd918aa73..cdc1e62f93 100644 --- a/panda/src/pnmimagetypes/pnmFileTypePNM.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypePNM.cxx @@ -20,6 +20,10 @@ #include "pnmFileTypeRegistry.h" #include "bamReader.h" +using std::istream; +using std::ostream; +using std::string; + static const char * const extensions_PNM[] = { "pbm", "pgm", "ppm", "pnm" }; diff --git a/panda/src/pnmimagetypes/pnmFileTypePfm.cxx b/panda/src/pnmimagetypes/pnmFileTypePfm.cxx index 71652689ec..89324f3c61 100644 --- a/panda/src/pnmimagetypes/pnmFileTypePfm.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypePfm.cxx @@ -18,6 +18,10 @@ #include "pnmFileTypeRegistry.h" #include "bamReader.h" +using std::istream; +using std::ostream; +using std::string; + TypeHandle PNMFileTypePfm::_type_handle; /** diff --git a/panda/src/pnmimagetypes/pnmFileTypeSGI.cxx b/panda/src/pnmimagetypes/pnmFileTypeSGI.cxx index e35880daa3..e2a99eb378 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeSGI.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeSGI.cxx @@ -21,6 +21,8 @@ #include "pnmFileTypeRegistry.h" #include "bamReader.h" +using std::string; + static const char * const extensions_sgi[] = { "rgb", "rgba", "sgi" }; @@ -100,7 +102,7 @@ matches_magic_number(const string &magic_number) const { * returns NULL. */ PNMReader *PNMFileTypeSGI:: -make_reader(istream *file, bool owns_file, const string &magic_number) { +make_reader(std::istream *file, bool owns_file, const string &magic_number) { init_pnm(); return new Reader(this, file, owns_file, magic_number); } @@ -111,7 +113,7 @@ make_reader(istream *file, bool owns_file, const string &magic_number) { * NULL. */ PNMWriter *PNMFileTypeSGI:: -make_writer(ostream *file, bool owns_file) { +make_writer(std::ostream *file, bool owns_file) { init_pnm(); return new Writer(this, file, owns_file); } diff --git a/panda/src/pnmimagetypes/pnmFileTypeSGIReader.cxx b/panda/src/pnmimagetypes/pnmFileTypeSGIReader.cxx index 2f56552d18..fafb625fac 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeSGIReader.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeSGIReader.cxx @@ -23,6 +23,9 @@ #include "pnotify.h" +using std::istream; +using std::string; + // Much code in this file is borrowed from Netpbm, specifically sgitopnm.c. /* sgitopnm.c - read an SGI image and and produce a portable anymap @@ -121,7 +124,7 @@ Reader(PNMFileType *type, istream *file, bool owns_file, string magic_number) : _x_size = head.xsize; _y_size = head.ysize; - _num_channels = min((int)head.zsize, 4); + _num_channels = std::min((int)head.zsize, 4); bpc = head.bpc; current_row = _y_size - 1; diff --git a/panda/src/pnmimagetypes/pnmFileTypeSGIWriter.cxx b/panda/src/pnmimagetypes/pnmFileTypeSGIWriter.cxx index faf45cc093..f5b143e867 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeSGIWriter.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeSGIWriter.cxx @@ -49,6 +49,8 @@ #define MAXVAL_BYTE 255 #define MAXVAL_WORD 65535 +using std::ostream; + inline void put_byte(ostream *out_file, unsigned char b) { out_file->put(b); diff --git a/panda/src/pnmimagetypes/pnmFileTypeSoftImage.cxx b/panda/src/pnmimagetypes/pnmFileTypeSoftImage.cxx index e2d12c3e33..d67a22fa53 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeSoftImage.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeSoftImage.cxx @@ -20,6 +20,10 @@ #include "pnmFileTypeRegistry.h" #include "bamReader.h" +using std::istream; +using std::ostream; +using std::string; + static const float imageVersionNumber = 3.0; static const int imageCommentLength = 80; static const char imageComment[imageCommentLength+1] = @@ -322,7 +326,7 @@ Reader(PNMFileType *type, istream *file, bool owns_file, string magic_number) : read_float(_file); // Skip comment - _file->seekg(imageCommentLength, ios::cur); + _file->seekg(imageCommentLength, std::ios::cur); char pict_id[4]; _file->read(pict_id, 4); diff --git a/panda/src/pnmimagetypes/pnmFileTypeStbImage.cxx b/panda/src/pnmimagetypes/pnmFileTypeStbImage.cxx index 93599cac83..96610157a4 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeStbImage.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeStbImage.cxx @@ -60,6 +60,10 @@ #include "stb_image.h" +using std::ios; +using std::istream; +using std::string; + static const char *const stb_extensions[] = { // Expose the extensions that we don't already expose through other loaders. #if !defined(HAVE_JPEG) && !defined(ANDROID) @@ -300,7 +304,7 @@ read_pfm(PfmFile &pfm) { } else { // We need to reinitialize the context. _file->seekg(0, ios::beg); - if (_file->tellg() != (streampos)0) { + if (_file->tellg() != (std::streampos)0) { pnmimage_cat.error() << "Could not reposition file pointer to the beginning.\n"; return false; @@ -482,7 +486,7 @@ read_data(xel *array, xelval *alpha) { } else { // We need to reinitialize the context. _file->seekg(0, ios::beg); - if (_file->tellg() != (streampos)0) { + if (_file->tellg() != (std::streampos)0) { pnmimage_cat.error() << "Could not reposition file pointer to the beginning.\n"; return false; diff --git a/panda/src/pnmimagetypes/pnmFileTypeTGA.cxx b/panda/src/pnmimagetypes/pnmFileTypeTGA.cxx index 3be6bd1ff0..18fc389150 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeTGA.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeTGA.cxx @@ -52,6 +52,10 @@ #include +using std::istream; +using std::ostream; +using std::string; + static const char * const extensions_tga[] = { "tga" }; diff --git a/panda/src/pnmimagetypes/pnmFileTypeTIFF.cxx b/panda/src/pnmimagetypes/pnmFileTypeTIFF.cxx index e2d5cf0fa1..3c4634055d 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeTIFF.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeTIFF.cxx @@ -28,6 +28,11 @@ #define int32 tiff_int32 #define uint32 tiff_uint32 +using std::ios; +using std::istream; +using std::ostream; +using std::string; + extern "C" { #include #include @@ -1046,13 +1051,13 @@ write_data(xel *array, xelval *alpha) { bytesperrow = _x_size * samplesperpixel; } else if ( grayscale ) { samplesperpixel = 1; - bitspersample = min(8, pm_maxvaltobits(_maxval)); + bitspersample = std::min(8, pm_maxvaltobits(_maxval)); photometric = PHOTOMETRIC_MINISBLACK; i = 8 / bitspersample; bytesperrow = ( _x_size + i - 1 ) / i; } else { samplesperpixel = 1; - bitspersample = min(8, pm_maxvaltobits(_maxval)); + bitspersample = std::min(8, pm_maxvaltobits(_maxval)); photometric = PHOTOMETRIC_PALETTE; bytesperrow = _x_size; } diff --git a/panda/src/pnmtext/freetypeFont.cxx b/panda/src/pnmtext/freetypeFont.cxx index 78a7455b96..f922943b7f 100644 --- a/panda/src/pnmtext/freetypeFont.cxx +++ b/panda/src/pnmtext/freetypeFont.cxx @@ -25,6 +25,10 @@ #undef interface // I don't know where this symbol is defined, but it interferes with FreeType. #include FT_OUTLINE_H +using std::istream; +using std::ostream; +using std::string; + // This constant determines how big a particular point size font appears to // be. By convention, 10 points is 1 unit (e.g. 1 foot) high. const PN_stdfloat FreetypeFont::_points_per_unit = 10.0f; @@ -461,7 +465,7 @@ render_distance_field(PNMImage &image, int outline, int min_x, int min_y) { } } else { - dist_sq = min((p - begin).length_squared(), (p - end).length_squared()); + dist_sq = std::min((p - begin).length_squared(), (p - end).length_squared()); if (begin[1] <= p[1]) { if (end[1] > p[1]) { if ((v[0] * (p[1] - begin[1]) > v[1] * (p[0] - begin[0]))) { @@ -503,7 +507,7 @@ render_distance_field(PNMImage &image, int outline, int min_x, int min_y) { } } - min_dist_sq = min(min_dist_sq, dist_sq); + min_dist_sq = std::min(min_dist_sq, dist_sq); } } // Determine the sign based on whether we're inside the contour. diff --git a/panda/src/pnmtext/pnmTextGlyph.cxx b/panda/src/pnmtext/pnmTextGlyph.cxx index 833febd98c..d52e415c02 100644 --- a/panda/src/pnmtext/pnmTextGlyph.cxx +++ b/panda/src/pnmtext/pnmTextGlyph.cxx @@ -14,6 +14,9 @@ #include "pnmTextGlyph.h" #include "indent.h" +using std::max; +using std::min; + /** * */ diff --git a/panda/src/pnmtext/pnmTextMaker.cxx b/panda/src/pnmtext/pnmTextMaker.cxx index 1cf2c92a75..8a22fff510 100644 --- a/panda/src/pnmtext/pnmTextMaker.cxx +++ b/panda/src/pnmtext/pnmTextMaker.cxx @@ -18,6 +18,8 @@ #include FT_OUTLINE_H +using std::wstring; + /** * The constructor expects the name of some font file that FreeType can read, * along with face_index, indicating which font within the file to load diff --git a/panda/src/pstatclient/pStatClient.cxx b/panda/src/pstatclient/pStatClient.cxx index 8a4a9fc288..c69e1ea032 100644 --- a/panda/src/pstatclient/pStatClient.cxx +++ b/panda/src/pstatclient/pStatClient.cxx @@ -27,6 +27,8 @@ #include "clockObject.h" #include "neverFreeMemory.h" +using std::string; + PStatCollector PStatClient::_heap_total_size_pcollector("System memory:Heap"); PStatCollector PStatClient::_heap_overhead_size_pcollector("System memory:Heap:Overhead"); PStatCollector PStatClient::_heap_single_size_pcollector("System memory:Heap:Single"); @@ -334,7 +336,7 @@ main_tick() { // Not used. break; } - ostringstream strm; + std::ostringstream strm; strm << "System memory:" << category << ":" << type; col = PStatCollector(strm.str()); } diff --git a/panda/src/pstatclient/pStatClientImpl.cxx b/panda/src/pstatclient/pStatClientImpl.cxx index d126c6c753..d607a53bd9 100644 --- a/panda/src/pstatclient/pStatClientImpl.cxx +++ b/panda/src/pstatclient/pStatClientImpl.cxx @@ -85,7 +85,7 @@ PStatClientImpl:: * Called only by PStatClient::client_connect(). */ bool PStatClientImpl:: -client_connect(string hostname, int port) { +client_connect(std::string hostname, int port) { nassertr(!_is_connected, true); if (hostname.empty()) { @@ -372,7 +372,7 @@ transmit_control_data() { /** * Returns the current machine's hostname. */ -string PStatClientImpl:: +std::string PStatClientImpl:: get_hostname() { if (_hostname.empty()) { char temp_buff[1024]; diff --git a/panda/src/pstatclient/pStatCollectorDef.cxx b/panda/src/pstatclient/pStatCollectorDef.cxx index 13070343e0..bdd0035bba 100644 --- a/panda/src/pstatclient/pStatCollectorDef.cxx +++ b/panda/src/pstatclient/pStatCollectorDef.cxx @@ -38,7 +38,7 @@ PStatCollectorDef() { * */ PStatCollectorDef:: -PStatCollectorDef(int index, const string &name) : +PStatCollectorDef(int index, const std::string &name) : _index(index), _name(name) { diff --git a/panda/src/pstatclient/pStatProperties.cxx b/panda/src/pstatclient/pStatProperties.cxx index 32db833ed5..cce31e693f 100644 --- a/panda/src/pstatclient/pStatProperties.cxx +++ b/panda/src/pstatclient/pStatProperties.cxx @@ -23,6 +23,8 @@ #include +using std::string; + static const int current_pstat_major_version = 3; static const int current_pstat_minor_version = 0; // Initialized at 2.0 on 51801, when version numbers were first added. diff --git a/panda/src/pstatclient/test_client.cxx b/panda/src/pstatclient/test_client.cxx index b60aa6c625..8151b808d2 100644 --- a/panda/src/pstatclient/test_client.cxx +++ b/panda/src/pstatclient/test_client.cxx @@ -85,7 +85,7 @@ public: int main(int argc, char *argv[]) { - string hostname = "localhost"; + std::string hostname = "localhost"; int port = pstats_port; if (argc > 1) { diff --git a/panda/src/putil/animInterface.cxx b/panda/src/putil/animInterface.cxx index 4727b4f907..304e4f95af 100644 --- a/panda/src/putil/animInterface.cxx +++ b/panda/src/putil/animInterface.cxx @@ -18,6 +18,9 @@ #include "datagram.h" #include "datagramIterator.h" +using std::max; +using std::min; + TypeHandle AnimInterface::_type_handle; /** @@ -61,7 +64,7 @@ get_num_frames() const { * */ void AnimInterface:: -output(ostream &out) const { +output(std::ostream &out) const { CDReader cdata(_cycler); cdata->output(out); } @@ -375,7 +378,7 @@ is_playing() const { * */ void AnimInterface::CData:: -output(ostream &out) const { +output(std::ostream &out) const { switch (_play_mode) { case PM_pose: out << "pose, frame " << get_full_fframe(); diff --git a/panda/src/putil/autoTextureScale.cxx b/panda/src/putil/autoTextureScale.cxx index ea17b6f08b..f9c27128ce 100644 --- a/panda/src/putil/autoTextureScale.cxx +++ b/panda/src/putil/autoTextureScale.cxx @@ -15,6 +15,10 @@ #include "string_utils.h" #include "config_putil.h" +using std::istream; +using std::ostream; +using std::string; + ostream & operator << (ostream &out, AutoTextureScale ats) { switch (ats) { diff --git a/panda/src/putil/bamCache.cxx b/panda/src/putil/bamCache.cxx index 385079d7ee..4dbcf06966 100644 --- a/panda/src/putil/bamCache.cxx +++ b/panda/src/putil/bamCache.cxx @@ -27,6 +27,11 @@ #include "configVariableFilename.h" #include "virtualFileSystem.h" +using std::istream; +using std::ostream; +using std::ostringstream; +using std::string; + BamCache *BamCache::_global_ptr = nullptr; /** @@ -966,7 +971,7 @@ hash_filename(const string &filename) { } ostringstream strm; - strm << hex << setw(8) << setfill('0') << hash; + strm << std::hex << std::setw(8) << std::setfill('0') << hash; return strm.str(); #endif // HAVE_OPENSSL diff --git a/panda/src/putil/bamCacheIndex.cxx b/panda/src/putil/bamCacheIndex.cxx index 889bb2a8ab..4455d5362d 100644 --- a/panda/src/putil/bamCacheIndex.cxx +++ b/panda/src/putil/bamCacheIndex.cxx @@ -37,7 +37,7 @@ BamCacheIndex:: * */ void BamCacheIndex:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << "BamCacheIndex, " << _records.size() << " records:\n"; @@ -45,13 +45,13 @@ write(ostream &out, int indent_level) const { for (ri = _records.begin(); ri != _records.end(); ++ri) { BamCacheRecord *record = (*ri).second; indent(out, indent_level + 2) - << setw(10) << record->_record_size << " " + << std::setw(10) << record->_record_size << " " << record->get_cache_filename() << " " << record->get_source_pathname() << "\n"; } out << "\n"; indent(out, indent_level) - << setw(12) << _cache_size << " bytes total\n"; + << std::setw(12) << _cache_size << " bytes total\n"; } /** @@ -129,7 +129,7 @@ evict_old_file() { */ bool BamCacheIndex:: add_record(BamCacheRecord *record) { - pair result = + std::pair result = _records.insert(Records::value_type(record->get_source_pathname(), record)); if (!result.second) { // We already had a record for this filename; it gets replaced. diff --git a/panda/src/putil/bamCacheRecord.cxx b/panda/src/putil/bamCacheRecord.cxx index f732dbcb9e..65a3c650f1 100644 --- a/panda/src/putil/bamCacheRecord.cxx +++ b/panda/src/putil/bamCacheRecord.cxx @@ -190,7 +190,7 @@ add_dependent_file(const VirtualFile *file) { * */ void BamCacheRecord:: -output(ostream &out) const { +output(std::ostream &out) const { out << "BamCacheRecord " << get_source_pathname(); } @@ -198,7 +198,7 @@ output(ostream &out) const { * */ void BamCacheRecord:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << "BamCacheRecord " << get_source_pathname() << "\n"; indent(out, indent_level) @@ -212,7 +212,7 @@ write(ostream &out, int indent_level) const { for (fi = _files.begin(); fi != _files.end(); ++fi) { const DependentFile &dfile = (*fi); indent(out, indent_level + 2) - << setw(10) << dfile._size << " " + << std::setw(10) << dfile._size << " " << format_timestamp(dfile._timestamp) << " " << dfile._pathname << "\n"; } @@ -221,7 +221,7 @@ write(ostream &out, int indent_level) const { /** * Returns a timestamp value formatted nicely for output. */ -string BamCacheRecord:: +std::string BamCacheRecord:: format_timestamp(time_t timestamp) { static const size_t buffer_size = 512; char buffer[buffer_size]; diff --git a/panda/src/putil/bamEnums.cxx b/panda/src/putil/bamEnums.cxx index ed1b18ac58..88d21cecf8 100644 --- a/panda/src/putil/bamEnums.cxx +++ b/panda/src/putil/bamEnums.cxx @@ -15,6 +15,10 @@ #include "string_utils.h" #include "config_putil.h" +using std::istream; +using std::ostream; +using std::string; + ostream & operator << (ostream &out, BamEnums::BamEndian be) { switch (be) { diff --git a/panda/src/putil/bamReader.cxx b/panda/src/putil/bamReader.cxx index a1b6641148..db360ae249 100644 --- a/panda/src/putil/bamReader.cxx +++ b/panda/src/putil/bamReader.cxx @@ -20,6 +20,8 @@ #include "config_putil.h" #include "pipelineCyclerBase.h" +using std::string; + TypeHandle BamReaderAuxData::_type_handle; WritableFactory *BamReader::_factory = nullptr; @@ -1111,7 +1113,7 @@ p_read_object() { default: bam_cat.error() - << "Encountered invalid BamObjectCode 0x" << hex << (int)boc << dec << ".\n"; + << "Encountered invalid BamObjectCode 0x" << std::hex << (int)boc << std::dec << ".\n"; return 0; } @@ -1251,7 +1253,7 @@ p_read_object() { if (object == nullptr) { if (bam_cat.is_debug()) { bam_cat.debug() - << "Unable to create an object of type " << type << endl; + << "Unable to create an object of type " << type << std::endl; } } else if (object->get_type() != type) { @@ -1263,7 +1265,7 @@ p_read_object() { bam_cat.warning() << "Attempted to create a " << type.get_name() \ << " but a " << object->get_type() \ - << " was created instead." << endl; + << " was created instead." << std::endl; } } else { @@ -1272,7 +1274,7 @@ p_read_object() { bam_cat.warning() << "Attempted to create a " << type.get_name() \ << " but a " << object->get_type() \ - << " was created instead." << endl; + << " was created instead." << std::endl; } } else { diff --git a/panda/src/putil/bitArray.cxx b/panda/src/putil/bitArray.cxx index f91c16d573..42f0d47259 100644 --- a/panda/src/putil/bitArray.cxx +++ b/panda/src/putil/bitArray.cxx @@ -16,6 +16,10 @@ #include "datagram.h" #include "datagramIterator.h" +using std::max; +using std::min; +using std::ostream; + TypeHandle BitArray::_type_handle; /** diff --git a/panda/src/putil/buttonHandle.cxx b/panda/src/putil/buttonHandle.cxx index 5495b7ce18..831a3daddd 100644 --- a/panda/src/putil/buttonHandle.cxx +++ b/panda/src/putil/buttonHandle.cxx @@ -27,14 +27,14 @@ TypeHandle ButtonHandle::_type_handle; * ButtonRegistry::register_button(). */ ButtonHandle:: -ButtonHandle(const string &name) { +ButtonHandle(const std::string &name) { _index = ButtonRegistry::ptr()->get_button(name)._index; } /** * Returns the name of the button. */ -string ButtonHandle:: +std::string ButtonHandle:: get_name() const { if ((*this) == ButtonHandle::none()) { return "none"; diff --git a/panda/src/putil/buttonMap.cxx b/panda/src/putil/buttonMap.cxx index 7fcc0fa516..2e74d929ce 100644 --- a/panda/src/putil/buttonMap.cxx +++ b/panda/src/putil/buttonMap.cxx @@ -20,7 +20,7 @@ TypeHandle ButtonMap::_type_handle; * Registers a new button mapping. */ void ButtonMap:: -map_button(ButtonHandle raw_button, ButtonHandle button, const string &label) { +map_button(ButtonHandle raw_button, ButtonHandle button, const std::string &label) { int index = raw_button.get_index(); if (_button_map.find(index) != _button_map.end()) { // A button with this index was already mapped. @@ -39,7 +39,7 @@ map_button(ButtonHandle raw_button, ButtonHandle button, const string &label) { * */ void ButtonMap:: -output(ostream &out) const { +output(std::ostream &out) const { out << "ButtonMap (" << get_num_buttons() << " buttons)"; } @@ -47,7 +47,7 @@ output(ostream &out) const { * */ void ButtonMap:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << "ButtonMap, " << get_num_buttons() << " buttons:\n"; diff --git a/panda/src/putil/buttonRegistry.cxx b/panda/src/putil/buttonRegistry.cxx index 2537dcc0dc..1800d9e88a 100644 --- a/panda/src/putil/buttonRegistry.cxx +++ b/panda/src/putil/buttonRegistry.cxx @@ -41,7 +41,7 @@ ButtonRegistry *ButtonRegistry::_global_pointer = nullptr; * right. */ bool ButtonRegistry:: -register_button(ButtonHandle &button_handle, const string &name, +register_button(ButtonHandle &button_handle, const std::string &name, ButtonHandle alias, char ascii_equivalent) { NameRegistry::iterator ri; ri = _name_registry.find(name); @@ -109,7 +109,7 @@ register_button(ButtonHandle &button_handle, const string &name, * is no such ButtonHandle, registers a new one and returns it. */ ButtonHandle ButtonRegistry:: -get_button(const string &name) { +get_button(const std::string &name) { NameRegistry::const_iterator ri; ri = _name_registry.find(name); @@ -127,7 +127,7 @@ get_button(const string &name) { * is no such ButtonHandle, returns ButtonHandle::none(). */ ButtonHandle ButtonRegistry:: -find_button(const string &name) { +find_button(const std::string &name) { NameRegistry::const_iterator ri; ri = _name_registry.find(name); @@ -155,7 +155,7 @@ find_ascii_button(char ascii_equivalent) const { * */ void ButtonRegistry:: -write(ostream &out) const { +write(std::ostream &out) const { out << "ASCII equivalents:\n"; for (int i = 1; i < 128; i++) { if (_handle_registry[i] != nullptr) { diff --git a/panda/src/putil/callbackData.cxx b/panda/src/putil/callbackData.cxx index de7eac9678..1a3f15672b 100644 --- a/panda/src/putil/callbackData.cxx +++ b/panda/src/putil/callbackData.cxx @@ -20,7 +20,7 @@ TypeHandle CallbackData::_type_handle; * */ void CallbackData:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type(); } diff --git a/panda/src/putil/callbackObject.cxx b/panda/src/putil/callbackObject.cxx index 9f1ce360ac..579b0299b7 100644 --- a/panda/src/putil/callbackObject.cxx +++ b/panda/src/putil/callbackObject.cxx @@ -20,7 +20,7 @@ TypeHandle CallbackObject::_type_handle; * */ void CallbackObject:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type(); } diff --git a/panda/src/putil/clockObject.cxx b/panda/src/putil/clockObject.cxx index 341a11374a..0eb72647e4 100644 --- a/panda/src/putil/clockObject.cxx +++ b/panda/src/putil/clockObject.cxx @@ -17,6 +17,10 @@ #include "string_utils.h" #include "thread.h" +using std::istream; +using std::ostream; +using std::string; + void (*ClockObject::_start_clock_wait)() = ClockObject::dummy_clock_wait; void (*ClockObject::_start_clock_busy_wait)() = ClockObject::dummy_clock_wait; void (*ClockObject::_stop_clock_wait)() = ClockObject::dummy_clock_wait; @@ -351,7 +355,7 @@ tick(Thread *current_thread) { // In case someone munged the clock last frame and sent us backward in // time, clamp the previous time to the current time to make sure we don't // report anything strange (or wait interminably). - old_time = min(old_time, _actual_frame_time); + old_time = std::min(old_time, _actual_frame_time); ++cdata->_frame_count; @@ -375,7 +379,7 @@ tick(Thread *current_thread) { double wait_until_time = old_time + 1.0 / _user_frame_rate; wait_until(wait_until_time); cdata->_dt = _actual_frame_time - old_time; - cdata->_reported_frame_time = max(_actual_frame_time, wait_until_time); + cdata->_reported_frame_time = std::max(_actual_frame_time, wait_until_time); } break; diff --git a/panda/src/putil/colorSpace.cxx b/panda/src/putil/colorSpace.cxx index 075eb438a1..3a244a68eb 100644 --- a/panda/src/putil/colorSpace.cxx +++ b/panda/src/putil/colorSpace.cxx @@ -21,6 +21,11 @@ #include +using std::istream; +using std::ostream; +using std::ostringstream; +using std::string; + ColorSpace parse_color_space_string(const string &str) { if (cmp_nocase_uh(str, "linear") == 0 || diff --git a/panda/src/putil/datagramBuffer.cxx b/panda/src/putil/datagramBuffer.cxx index c9831a4f82..7b1acb4ba1 100644 --- a/panda/src/putil/datagramBuffer.cxx +++ b/panda/src/putil/datagramBuffer.cxx @@ -20,7 +20,7 @@ * written. */ bool DatagramBuffer:: -write_header(const string &header) { +write_header(const std::string &header) { nassertr(!_wrote_first_datagram, false); _data.insert(_data.end(), header.begin(), header.end()); @@ -78,13 +78,13 @@ flush() { * has been read. */ bool DatagramBuffer:: -read_header(string &header, size_t num_bytes) { +read_header(std::string &header, size_t num_bytes) { nassertr(!_read_first_datagram, false); if (_read_offset + num_bytes > _data.size()) { return false; } - header = string((char *)&_data[_read_offset], num_bytes); + header = std::string((char *)&_data[_read_offset], num_bytes); _read_offset += num_bytes; return true; } diff --git a/panda/src/putil/datagramInputFile.cxx b/panda/src/putil/datagramInputFile.cxx index 466d78006b..c4802ceed2 100644 --- a/panda/src/putil/datagramInputFile.cxx +++ b/panda/src/putil/datagramInputFile.cxx @@ -22,6 +22,9 @@ #include "streamReader.h" #include "thread.h" +using std::streampos; +using std::streamsize; + /** * Opens the indicated filename for reading. Returns true on success, false * on failure. @@ -54,7 +57,7 @@ open(const FileReference *file) { * you are responsible for closing or deleting it when you are done. */ bool DatagramInputFile:: -open(istream &in, const Filename &filename) { +open(std::istream &in, const Filename &filename) { close(); _in = ∈ @@ -98,7 +101,7 @@ close() { * has been read. */ bool DatagramInputFile:: -read_header(string &header, size_t num_bytes) { +read_header(std::string &header, size_t num_bytes) { nassertr(!_read_first_datagram, false); nassertr(_in != nullptr, false); @@ -110,7 +113,7 @@ read_header(string &header, size_t num_bytes) { return false; } - header = string(buffer, num_bytes); + header = std::string(buffer, num_bytes); Thread::consider_yield(); return true; } @@ -170,7 +173,7 @@ get_datagram(Datagram &data) { // standards. Let's take it 4MB at a time just in case the length is // corrupt, so we don't allocate potentially a few GBs of RAM only to // find a truncated file. - bytes_left = min(bytes_left, (size_t)4*1024*1024); + bytes_left = std::min(bytes_left, (size_t)4*1024*1024); PTA_uchar buffer = data.modify_array(); buffer.resize(buffer.size() + bytes_left); @@ -221,7 +224,7 @@ save_datagram(SubfileInfo &info) { // into this file. if (_file != nullptr) { info = SubfileInfo(_file, _in->tellg(), num_bytes); - _in->seekg(num_bytes, ios::cur); + _in->seekg(num_bytes, std::ios::cur); return true; } @@ -245,7 +248,7 @@ save_datagram(SubfileInfo &info) { static const size_t buffer_size = 4096; char buffer[buffer_size]; - _in->read(buffer, min((streamsize)buffer_size, num_remaining)); + _in->read(buffer, std::min((streamsize)buffer_size, num_remaining)); streamsize count = _in->gcount(); while (count != 0) { out.write(buffer, count); @@ -259,7 +262,7 @@ save_datagram(SubfileInfo &info) { if (num_remaining == 0) { break; } - _in->read(buffer, min((streamsize)buffer_size, num_remaining)); + _in->read(buffer, std::min((streamsize)buffer_size, num_remaining)); count = _in->gcount(); } diff --git a/panda/src/putil/datagramOutputFile.cxx b/panda/src/putil/datagramOutputFile.cxx index 24533ad8b0..407e1adfec 100644 --- a/panda/src/putil/datagramOutputFile.cxx +++ b/panda/src/putil/datagramOutputFile.cxx @@ -16,6 +16,10 @@ #include "zStream.h" #include +using std::min; +using std::streampos; +using std::streamsize; + /** * Opens the indicated filename for writing. Returns true if successful, * false on failure. @@ -47,7 +51,7 @@ open(const FileReference *file) { * are responsible for closing or deleting it when you are done. */ bool DatagramOutputFile:: -open(ostream &out, const Filename &filename) { +open(std::ostream &out, const Filename &filename) { close(); _out = &out; @@ -89,7 +93,7 @@ close() { * written. */ bool DatagramOutputFile:: -write_header(const string &header) { +write_header(const std::string &header) { nassertr(_out != nullptr, false); nassertr(!_wrote_first_datagram, false); @@ -145,7 +149,7 @@ copy_datagram(SubfileInfo &result, const Filename &filename) { if (vfile == nullptr) { return false; } - istream *in = vfile->open_read_file(true); + std::istream *in = vfile->open_read_file(true); if (in == nullptr) { return false; } diff --git a/panda/src/putil/factoryBase.cxx b/panda/src/putil/factoryBase.cxx index bfb803da39..eeba7183dc 100644 --- a/panda/src/putil/factoryBase.cxx +++ b/panda/src/putil/factoryBase.cxx @@ -212,7 +212,7 @@ get_preferred(int n) const { * output stream, one per line. */ void FactoryBase:: -write_types(ostream &out, int indent_level) const { +write_types(std::ostream &out, int indent_level) const { Creators::const_iterator ci; for (ci = _creators.begin(); ci != _creators.end(); ++ci) { indent(out, indent_level) << (*ci).first << "\n"; diff --git a/panda/src/putil/globalPointerRegistry.cxx b/panda/src/putil/globalPointerRegistry.cxx index 622a666f6e..2f6f308baf 100644 --- a/panda/src/putil/globalPointerRegistry.cxx +++ b/panda/src/putil/globalPointerRegistry.cxx @@ -57,7 +57,7 @@ ns_store_pointer(TypeHandle type, void *ptr) { clear_pointer(type); return; } - pair result = + std::pair result = _pointers.insert(Pointers::value_type(type, ptr)); if (!result.second) { diff --git a/panda/src/putil/keyboardButton.cxx b/panda/src/putil/keyboardButton.cxx index e6d7162d50..3ab8e38265 100644 --- a/panda/src/putil/keyboardButton.cxx +++ b/panda/src/putil/keyboardButton.cxx @@ -155,7 +155,7 @@ init_keyboard_buttons() { for (int i = 32; i < 127; i++) { if (isgraph(i)) { ButtonHandle key; - ButtonRegistry::ptr()->register_button(key, string(1, (char)i), + ButtonRegistry::ptr()->register_button(key, std::string(1, (char)i), ButtonHandle::none(), i); } } diff --git a/panda/src/putil/load_prc_file.cxx b/panda/src/putil/load_prc_file.cxx index 7da6526c9c..f40296b403 100644 --- a/panda/src/putil/load_prc_file.cxx +++ b/panda/src/putil/load_prc_file.cxx @@ -43,7 +43,7 @@ load_prc_file(const Filename &filename) { vfs->resolve_filename(path, cp_mgr->get_search_path()) || vfs->resolve_filename(path, get_model_path()); - istream *file = vfs->open_read_file(path, true); + std::istream *file = vfs->open_read_file(path, true); if (file == nullptr) { util_cat.error() << "Unable to open " << path << "\n"; @@ -78,8 +78,8 @@ load_prc_file(const Filename &filename) { * loaded prc files is listed. */ EXPCL_PANDA_PUTIL ConfigPage * -load_prc_file_data(const string &name, const string &data) { - istringstream strm(data); +load_prc_file_data(const std::string &name, const std::string &data) { + std::istringstream strm(data); ConfigPageManager *cp_mgr = ConfigPageManager::get_global_ptr(); @@ -121,7 +121,7 @@ unload_prc_file(ConfigPage *page) { */ void hash_prc_variables(HashVal &hash) { - ostringstream strm; + std::ostringstream strm; ConfigVariableManager *cv_mgr = ConfigVariableManager::get_global_ptr(); cv_mgr->write_prc_variables(strm); hash.hash_string(strm.str()); diff --git a/panda/src/putil/loaderOptions.cxx b/panda/src/putil/loaderOptions.cxx index 167d977cd7..508e22f23c 100644 --- a/panda/src/putil/loaderOptions.cxx +++ b/panda/src/putil/loaderOptions.cxx @@ -15,6 +15,8 @@ #include "config_putil.h" #include "indent.h" +using std::string; + /** * */ @@ -54,7 +56,7 @@ LoaderOptions(int flags) : * */ void LoaderOptions:: -output(ostream &out) const { +output(std::ostream &out) const { out << "LoaderOptions("; string sep = ""; @@ -100,7 +102,7 @@ output(ostream &out) const { * Used to implement output(). */ void LoaderOptions:: -write_flag(ostream &out, string &sep, +write_flag(std::ostream &out, string &sep, const string &flag_name, int flag) const { if ((_flags & flag) == flag) { out << sep << flag_name; @@ -112,7 +114,7 @@ write_flag(ostream &out, string &sep, * Used to implement output(). */ void LoaderOptions:: -write_texture_flag(ostream &out, string &sep, +write_texture_flag(std::ostream &out, string &sep, const string &flag_name, int flag) const { if ((_texture_flags & flag) == flag) { out << sep << flag_name; diff --git a/panda/src/putil/modifierButtons.cxx b/panda/src/putil/modifierButtons.cxx index a0c4a79146..00a75fcdd9 100644 --- a/panda/src/putil/modifierButtons.cxx +++ b/panda/src/putil/modifierButtons.cxx @@ -302,9 +302,9 @@ is_down(ButtonHandle button) const { * Returns a string which can be used to prefix any button name or event name * with the unique set of modifier buttons currently being held. */ -string ModifierButtons:: +std::string ModifierButtons:: get_prefix() const { - string prefix; + std::string prefix; for (int i = 0; i < (int)_button_list.size(); i++) { if ((_state & ((BitmaskType)1 << i)) != 0) { prefix += _button_list[i].get_name(); @@ -319,7 +319,7 @@ get_prefix() const { * Writes a one-line summary of the buttons known to be down. */ void ModifierButtons:: -output(ostream &out) const { +output(std::ostream &out) const { out << "["; for (int i = 0; i < (int)_button_list.size(); i++) { if ((_state & ((BitmaskType)1 << i)) != 0) { @@ -334,7 +334,7 @@ output(ostream &out) const { * and which ones are known to be down. */ void ModifierButtons:: -write(ostream &out) const { +write(std::ostream &out) const { out << "ModifierButtons:\n"; for (int i = 0; i < (int)_button_list.size(); i++) { out << " " << _button_list[i]; diff --git a/panda/src/putil/mouseData.cxx b/panda/src/putil/mouseData.cxx index 8149672c9b..de83bd1505 100644 --- a/panda/src/putil/mouseData.cxx +++ b/panda/src/putil/mouseData.cxx @@ -17,7 +17,7 @@ * */ void MouseData:: -output(ostream &out) const { +output(std::ostream &out) const { if (!_in_window) { out << "MouseData: Not in window"; } else { diff --git a/panda/src/putil/nameUniquifier.cxx b/panda/src/putil/nameUniquifier.cxx index 0629a58ac9..e6ab3f6917 100644 --- a/panda/src/putil/nameUniquifier.cxx +++ b/panda/src/putil/nameUniquifier.cxx @@ -17,6 +17,8 @@ #include +using std::string; + /** * Creates a new NameUniquifier. diff --git a/panda/src/putil/paramValue.cxx b/panda/src/putil/paramValue.cxx index 309f8885bd..5ffcf2807c 100644 --- a/panda/src/putil/paramValue.cxx +++ b/panda/src/putil/paramValue.cxx @@ -56,7 +56,7 @@ ParamTypedRefCount:: * */ void ParamTypedRefCount:: -output(ostream &out) const { +output(std::ostream &out) const { if (_value == nullptr) { out << "(empty)"; diff --git a/panda/src/putil/sparseArray.cxx b/panda/src/putil/sparseArray.cxx index 37940d1d10..6373e53039 100644 --- a/panda/src/putil/sparseArray.cxx +++ b/panda/src/putil/sparseArray.cxx @@ -214,7 +214,7 @@ has_bits_in_common(const SparseArray &other) const { * */ void SparseArray:: -output(ostream &out) const { +output(std::ostream &out) const { out << "[ "; if (_inverse) { out << "all except: "; @@ -442,7 +442,7 @@ do_remove_range(int begin, int end) { si = _subranges.begin() + _subranges.size() - 1; if ((*si)._end >= begin) { // The new range shortens the last element of the array on the right. - end = min(end, (*si)._begin); + end = std::min(end, (*si)._begin); (*si)._end = end; // It might also shorten it on the left; fall through. } else { @@ -465,7 +465,7 @@ do_remove_range(int begin, int end) { if ((*si2)._end >= begin) { // The new range shortens an element within the array on the right // (but does not intersect the next element). - end = min(end, (*si2)._begin); + end = std::min(end, (*si2)._begin); (*si2)._end = end; // It might also shorten it on the left; fall through. si = si2; @@ -499,7 +499,7 @@ do_remove_range(int begin, int end) { si = si2; } - (*si)._end = min((*si)._end, begin); + (*si)._end = std::min((*si)._end, begin); } /** diff --git a/panda/src/putil/test_bam.cxx b/panda/src/putil/test_bam.cxx index a6103d5c5f..bf6d862434 100644 --- a/panda/src/putil/test_bam.cxx +++ b/panda/src/putil/test_bam.cxx @@ -17,6 +17,8 @@ #include "test_bam.h" +using std::endl; + TypeHandle Person::_type_handle; TypeHandle Parent::_type_handle; diff --git a/panda/src/putil/test_bamRead.cxx b/panda/src/putil/test_bamRead.cxx index d49f49434b..50949f63eb 100644 --- a/panda/src/putil/test_bamRead.cxx +++ b/panda/src/putil/test_bamRead.cxx @@ -20,7 +20,7 @@ int main(int argc, char* argv[]) { - string test_file = "bamTest.out"; + std::string test_file = "bamTest.out"; DatagramInputFile stream; bool success = stream.open(test_file); nassertr(success, 1); @@ -37,11 +37,11 @@ int main(int argc, char* argv[]) manager.resolve(); dad->print_relationships(); - nout << endl; + nout << std::endl; mom->print_relationships(); - nout << endl; + nout << std::endl; bro->print_relationships(); - nout << endl; + nout << std::endl; sis->print_relationships(); return 0; diff --git a/panda/src/putil/test_bamWrite.cxx b/panda/src/putil/test_bamWrite.cxx index 59d56930ec..9469b8a6a3 100644 --- a/panda/src/putil/test_bamWrite.cxx +++ b/panda/src/putil/test_bamWrite.cxx @@ -19,7 +19,7 @@ int main(int argc, char* argv[]) { - string test_file("bamTest.out"); + std::string test_file("bamTest.out"); DatagramOutputFile stream; bool success = stream.open(test_file); nassertr(success, 1); diff --git a/panda/src/putil/test_glob.cxx b/panda/src/putil/test_glob.cxx index 32ba0d1927..cc5141dcdd 100644 --- a/panda/src/putil/test_glob.cxx +++ b/panda/src/putil/test_glob.cxx @@ -16,7 +16,7 @@ int main(int argc, char *argv[]) { if (argc != 2 && argc != 3) { - cerr + std::cerr << "test_glob \"pattern\" [from-directory]\n\n" << "Attempts to match the pattern against each of the files in the\n" << "indicated directory if specified, or the current directory\n" @@ -36,10 +36,10 @@ main(int argc, char *argv[]) { vector_string results; int num_matched = pattern.match_files(results, from_directory); - cerr << num_matched << " results:\n"; + std::cerr << num_matched << " results:\n"; vector_string::const_iterator si; for (si = results.begin(); si != results.end(); ++si) { - cerr << " " << *si << "\n"; + std::cerr << " " << *si << "\n"; } return (0); diff --git a/panda/src/putil/test_uniqueIdAllocator.cxx b/panda/src/putil/test_uniqueIdAllocator.cxx index be39a01450..73c3c6b498 100644 --- a/panda/src/putil/test_uniqueIdAllocator.cxx +++ b/panda/src/putil/test_uniqueIdAllocator.cxx @@ -4,7 +4,9 @@ #include #include #include -using namespace std; + +using std::cout; +using std::endl; #include "uniqueIdAllocator.h" diff --git a/panda/src/putil/typedWritable.cxx b/panda/src/putil/typedWritable.cxx index d0e5058538..8ca4081c63 100644 --- a/panda/src/putil/typedWritable.cxx +++ b/panda/src/putil/typedWritable.cxx @@ -190,11 +190,11 @@ bool TypedWritable:: decode_raw_from_bam_stream(TypedWritable *&ptr, ReferenceCount *&ref_ptr, vector_uchar data, BamReader *reader) { - DatagramBuffer buffer(move(data)); + DatagramBuffer buffer(std::move(data)); if (reader == nullptr) { // Create a local reader. - string head; + std::string head; if (!buffer.read_header(head, _bam_header.size())) { return false; } diff --git a/panda/src/putil/typedWritableReferenceCount.cxx b/panda/src/putil/typedWritableReferenceCount.cxx index ba4e2c49e4..3ca6d27550 100644 --- a/panda/src/putil/typedWritableReferenceCount.cxx +++ b/panda/src/putil/typedWritableReferenceCount.cxx @@ -41,7 +41,7 @@ decode_from_bam_stream(vector_uchar data, BamReader *reader) { TypedWritable *object; ReferenceCount *ref_ptr; - if (TypedWritable::decode_raw_from_bam_stream(object, ref_ptr, move(data), reader)) { + if (TypedWritable::decode_raw_from_bam_stream(object, ref_ptr, std::move(data), reader)) { return DCAST(TypedWritableReferenceCount, object); } else { return nullptr; diff --git a/panda/src/putil/typedWritable_ext.cxx b/panda/src/putil/typedWritable_ext.cxx index c736a6fa14..3db4b086c3 100644 --- a/panda/src/putil/typedWritable_ext.cxx +++ b/panda/src/putil/typedWritable_ext.cxx @@ -52,9 +52,9 @@ __reduce_persist__(PyObject *self, PyObject *pickler) const { // can't use this interface. PyObject *method = PyObject_GetAttrString(self, "decode_from_bam_stream"); if (method == nullptr) { - ostringstream stream; + std::ostringstream stream; stream << "Cannot pickle objects of type " << _this->get_type() << "\n"; - string message = stream.str(); + std::string message = stream.str(); PyErr_SetString(PyExc_TypeError, message.c_str()); return nullptr; } @@ -75,9 +75,9 @@ __reduce_persist__(PyObject *self, PyObject *pickler) const { // First, streamify the object, if possible. vector_uchar bam_stream; if (!_this->encode_to_bam_stream(bam_stream, writer)) { - ostringstream stream; + std::ostringstream stream; stream << "Could not bamify object of type " << _this->get_type() << "\n"; - string message = stream.str(); + std::string message = stream.str(); PyErr_SetString(PyExc_TypeError, message.c_str()); return nullptr; } diff --git a/panda/src/putil/uniqueIdAllocator.cxx b/panda/src/putil/uniqueIdAllocator.cxx index 0b3307a2af..6c4edd9795 100644 --- a/panda/src/putil/uniqueIdAllocator.cxx +++ b/panda/src/putil/uniqueIdAllocator.cxx @@ -17,6 +17,8 @@ #include "uniqueIdAllocator.h" +using std::endl; + NotifyCategoryDecl(uniqueIdAllocator, EXPCL_PANDA_PUTIL, EXPTP_PANDA_PUTIL); NotifyCategoryDef(uniqueIdAllocator, ""); @@ -212,7 +214,7 @@ fraction_used() const { * ...intended for debugging only. */ void UniqueIdAllocator:: -output(ostream &out) const { +output(std::ostream &out) const { out << "UniqueIdAllocator(" << _min << ", " << _max << "), " << _free << " id's remaining of " << _size; } @@ -221,7 +223,7 @@ output(ostream &out) const { * ...intended for debugging only. */ void UniqueIdAllocator:: -write(ostream &out) const { +write(std::ostream &out) const { out << "_min: " << _min << "; _max: " << _max << ";\n_next_free: " << int32_t(_next_free) << "; _last_free: " << int32_t(_last_free) diff --git a/panda/src/recorder/mouseRecorder.cxx b/panda/src/recorder/mouseRecorder.cxx index a79c7dc49b..37a5a2a440 100644 --- a/panda/src/recorder/mouseRecorder.cxx +++ b/panda/src/recorder/mouseRecorder.cxx @@ -23,7 +23,7 @@ TypeHandle MouseRecorder::_type_handle; * */ MouseRecorder:: -MouseRecorder(const string &name) : +MouseRecorder(const std::string &name) : DataNode(name) { _pixel_xy_input = define_input("pixel_xy", EventStoreVec2::get_class_type()); @@ -88,7 +88,7 @@ play_frame(DatagramIterator &scan, BamReader *manager) { * */ void MouseRecorder:: -output(ostream &out) const { +output(std::ostream &out) const { DataNode::output(out); } @@ -96,7 +96,7 @@ output(ostream &out) const { * */ void MouseRecorder:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { DataNode::write(out, indent_level); } diff --git a/panda/src/recorder/recorderController.cxx b/panda/src/recorder/recorderController.cxx index b383402715..805ea5778a 100644 --- a/panda/src/recorder/recorderController.cxx +++ b/panda/src/recorder/recorderController.cxx @@ -113,7 +113,7 @@ begin_playback(const Filename &filename) { return false; } - string head; + std::string head; if (!_din.read_header(head, _bam_header.size()) || head != _bam_header) { recorder_cat.error() << "Unable to read " << _filename << "\n"; return false; diff --git a/panda/src/recorder/recorderTable.cxx b/panda/src/recorder/recorderTable.cxx index 27fc5ed2c8..4db629865f 100644 --- a/panda/src/recorder/recorderTable.cxx +++ b/panda/src/recorder/recorderTable.cxx @@ -18,6 +18,8 @@ #include "recorderController.h" #include "indent.h" +using std::string; + TypeHandle RecorderTable::_type_handle; /** @@ -140,7 +142,7 @@ clear_flags(short flags) { * */ void RecorderTable:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << "RecorderTable:\n"; diff --git a/panda/src/recorder/socketStreamRecorder.cxx b/panda/src/recorder/socketStreamRecorder.cxx index 9c9d66b310..5ee6168d44 100644 --- a/panda/src/recorder/socketStreamRecorder.cxx +++ b/panda/src/recorder/socketStreamRecorder.cxx @@ -85,7 +85,7 @@ play_frame(DatagramIterator &scan, BamReader *manager) { size_t size = scan.get_uint16(); vector_uchar packet(size); scan.extract_bytes(&packet[0], size); - _data.push_back(Datagram(move(packet))); + _data.push_back(Datagram(std::move(packet))); } } diff --git a/panda/src/rocket/rocketFileInterface.cxx b/panda/src/rocket/rocketFileInterface.cxx index 0c3a25fc29..5a54e31c8f 100644 --- a/panda/src/rocket/rocketFileInterface.cxx +++ b/panda/src/rocket/rocketFileInterface.cxx @@ -50,7 +50,7 @@ Open(const Rocket::Core::String& path) { } } - istream *str = file->open_read_file(true); + std::istream *str = file->open_read_file(true); if (str == nullptr) { rocket_cat.error() << "Failed to open " << fn << " for reading\n"; return (Rocket::Core::FileHandle) nullptr; @@ -104,13 +104,13 @@ Seek(Rocket::Core::FileHandle file, long offset, int origin) { switch(origin) { case SEEK_SET: - handle->_stream->seekg(offset, ios::beg); + handle->_stream->seekg(offset, std::ios::beg); break; case SEEK_CUR: - handle->_stream->seekg(offset, ios::cur); + handle->_stream->seekg(offset, std::ios::cur); break; case SEEK_END: - handle->_stream->seekg(offset, ios::end); + handle->_stream->seekg(offset, std::ios::end); }; return !handle->_stream->fail(); diff --git a/panda/src/rocket/rocketInputHandler.cxx b/panda/src/rocket/rocketInputHandler.cxx index fcfa6dc2cf..6b07e3a02b 100644 --- a/panda/src/rocket/rocketInputHandler.cxx +++ b/panda/src/rocket/rocketInputHandler.cxx @@ -31,7 +31,7 @@ TypeHandle RocketInputHandler::_type_handle; * */ RocketInputHandler:: -RocketInputHandler(const string &name) : +RocketInputHandler(const std::string &name) : DataNode(name), _mouse_xy(-1), _mouse_xy_changed(false), diff --git a/panda/src/rocket/rocketRegion.cxx b/panda/src/rocket/rocketRegion.cxx index fe21d5c6c2..17fdc8f55f 100644 --- a/panda/src/rocket/rocketRegion.cxx +++ b/panda/src/rocket/rocketRegion.cxx @@ -31,7 +31,7 @@ TypeHandle RocketRegion::_type_handle; */ RocketRegion:: RocketRegion(GraphicsOutput *window, const LVecBase4 &dr_dimensions, - const string &context_name) : + const std::string &context_name) : DisplayRegion(window, dr_dimensions) { // A hack I don't like. libRocket's decorator system has a bug somewhere, diff --git a/panda/src/speedtree/loaderFileTypeSrt.cxx b/panda/src/speedtree/loaderFileTypeSrt.cxx index 0f67d2fb96..fa1f7b3a48 100644 --- a/panda/src/speedtree/loaderFileTypeSrt.cxx +++ b/panda/src/speedtree/loaderFileTypeSrt.cxx @@ -27,7 +27,7 @@ LoaderFileTypeSrt() { /** * */ -string LoaderFileTypeSrt:: +std::string LoaderFileTypeSrt:: get_name() const { return "SpeedTree compiled tree"; } @@ -35,7 +35,7 @@ get_name() const { /** * */ -string LoaderFileTypeSrt:: +std::string LoaderFileTypeSrt:: get_extension() const { return "srt"; } diff --git a/panda/src/speedtree/loaderFileTypeStf.cxx b/panda/src/speedtree/loaderFileTypeStf.cxx index 2f568fae3c..981d36b59b 100644 --- a/panda/src/speedtree/loaderFileTypeStf.cxx +++ b/panda/src/speedtree/loaderFileTypeStf.cxx @@ -26,7 +26,7 @@ LoaderFileTypeStf() { /** * */ -string LoaderFileTypeStf:: +std::string LoaderFileTypeStf:: get_name() const { return "SpeedTree compiled tree"; } @@ -34,7 +34,7 @@ get_name() const { /** * */ -string LoaderFileTypeStf:: +std::string LoaderFileTypeStf:: get_extension() const { return "stf"; } diff --git a/panda/src/speedtree/speedTreeNode.cxx b/panda/src/speedtree/speedTreeNode.cxx index da8c036d8e..48cda1204b 100644 --- a/panda/src/speedtree/speedTreeNode.cxx +++ b/panda/src/speedtree/speedTreeNode.cxx @@ -42,6 +42,10 @@ #include "dxGraphicsStateGuardian9.h" #endif +using std::istream; +using std::ostream; +using std::string; + double SpeedTreeNode::_global_time_delta = 0.0; bool SpeedTreeNode::_authorized; bool SpeedTreeNode::_done_first_init; @@ -155,7 +159,7 @@ add_tree(const STTree *tree) { if (ti == _trees.end()) { // This is the first time that this particular tree has been added. InstanceList *instance_list = new InstanceList(tree); - pair result = _trees.insert(instance_list); + std::pair result = _trees.insert(instance_list); ti = result.first; bool inserted = result.second; nassertr(inserted, *(*ti)); @@ -1245,10 +1249,10 @@ repopulate() { SpeedTree::CMap::const_iterator si; si = _population_stats.m_mMaxNumInstancesPerCellPerBase.find(tree->get_tree()); if (si != _population_stats.m_mMaxNumInstancesPerCellPerBase.end()) { - max_instances = max(max_instances, (int)si->second); + max_instances = std::max(max_instances, (int)si->second); } - max_instances_by_cell = max(max_instances_by_cell, max_instances); + max_instances_by_cell = std::max(max_instances_by_cell, max_instances); } _visible_trees.Reserve(_forest_render.GetBaseTrees(), @@ -1547,7 +1551,7 @@ setup_for_render(GraphicsStateGuardian *gsg) { SpeedTree::CMap::const_iterator si; si = _population_stats.m_mMaxNumInstancesPerCellPerBase.find(tree->get_tree()); if (si != _population_stats.m_mMaxNumInstancesPerCellPerBase.end()) { - max_instances = max(max_instances, (int)si->second); + max_instances = std::max(max_instances, (int)si->second); } // Get the speedtree-textures-dir to pass for initialization. diff --git a/panda/src/speedtree/stBasicTerrain.cxx b/panda/src/speedtree/stBasicTerrain.cxx index 2a6dba22f4..1c32cfe02f 100644 --- a/panda/src/speedtree/stBasicTerrain.cxx +++ b/panda/src/speedtree/stBasicTerrain.cxx @@ -16,6 +16,10 @@ #include "pnmImage.h" #include "indent.h" +using std::istream; +using std::ostream; +using std::string; + TypeHandle STBasicTerrain::_type_handle; // VERTEX_ATTRIB_END is defined as a macro that must be evaluated within the @@ -345,8 +349,8 @@ read_height_map() { v *= scalar; _height_data._data[pi] = v; ++pi; - _min_height = min(_min_height, v); - _max_height = max(_max_height, v); + _min_height = std::min(_min_height, v); + _max_height = std::max(_max_height, v); } } diff --git a/panda/src/speedtree/stTerrain.cxx b/panda/src/speedtree/stTerrain.cxx index fef97b9d0d..9215a5dd26 100644 --- a/panda/src/speedtree/stTerrain.cxx +++ b/panda/src/speedtree/stTerrain.cxx @@ -149,7 +149,7 @@ fill_vertices(GeomVertexData *data, * */ void STTerrain:: -output(ostream &out) const { +output(std::ostream &out) const { Namable::output(out); } @@ -157,7 +157,7 @@ output(ostream &out) const { * */ void STTerrain:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << *this << "\n"; } diff --git a/panda/src/speedtree/stTransform.cxx b/panda/src/speedtree/stTransform.cxx index aab4be7e93..dfdb586a6c 100644 --- a/panda/src/speedtree/stTransform.cxx +++ b/panda/src/speedtree/stTransform.cxx @@ -44,7 +44,7 @@ STTransform(const TransformState *trans) { * */ void STTransform:: -output(ostream &out) const { +output(std::ostream &out) const { out << "STTransform(" << _pos << ", " << _rotate << ", " << _scale << ")"; } diff --git a/panda/src/speedtree/stTree.cxx b/panda/src/speedtree/stTree.cxx index 7a09205d6e..a34b36e7a4 100644 --- a/panda/src/speedtree/stTree.cxx +++ b/panda/src/speedtree/stTree.cxx @@ -48,7 +48,7 @@ STTree(const Filename &fullpath) : } */ - string os_fullpath = _fullpath.to_os_specific(); + std::string os_fullpath = _fullpath.to_os_specific(); if (!_tree.LoadTree(os_fullpath.c_str())) { speedtree_cat.warning() << "Couldn't read: " << _fullpath << "\n"; @@ -65,7 +65,7 @@ STTree(const Filename &fullpath) : * */ void STTree:: -output(ostream &out) const { +output(std::ostream &out) const { if (!is_valid()) { out << "(invalid STTree)"; } else { diff --git a/panda/src/testbed/pgrid.cxx b/panda/src/testbed/pgrid.cxx index d93cf64382..6858165bdf 100644 --- a/panda/src/testbed/pgrid.cxx +++ b/panda/src/testbed/pgrid.cxx @@ -22,6 +22,8 @@ #define RANDFRAC (rand()/(PN_stdfloat)(RAND_MAX)) +using std::string; + class GriddedFilename { public: Filename _filename; @@ -244,7 +246,7 @@ load_gridded_models(WindowFramework *window, } grid_pos_offset = -gridwidth*GRIDCELLSIZE/2.0; - wander_area_pos_offset = -max((PN_stdfloat)fabs(grid_pos_offset), MIN_WANDERAREA_DIMENSION/2.0f); + wander_area_pos_offset = -std::max((PN_stdfloat)fabs(grid_pos_offset), MIN_WANDERAREA_DIMENSION/2.0f); // Now walk through the list again, copying models into the scene graph as // we go. diff --git a/panda/src/testbed/pview.cxx b/panda/src/testbed/pview.cxx index 8d39104d64..73e71a358d 100644 --- a/panda/src/testbed/pview.cxx +++ b/panda/src/testbed/pview.cxx @@ -29,6 +29,9 @@ #include "asyncTask.h" #include "boundingSphere.h" +using std::cerr; +using std::endl; + PandaFramework framework; ConfigVariableBool pview_test_hack @@ -237,7 +240,7 @@ report_version() { // class AdjustCameraClipPlanesTask : public AsyncTask { public: - AdjustCameraClipPlanesTask(const string &name, Camera *camera) : + AdjustCameraClipPlanesTask(const std::string &name, Camera *camera) : AsyncTask(name), _camera(camera), _lens(camera->get_lens(0)), _sphere(nullptr) { NodePath np = framework.get_models(); @@ -317,12 +320,12 @@ public: // Ensure the far plane is far enough back to see the entire object. PN_stdfloat ideal_far_plane = distance + radius * 1.5; - _lens->set_far(max(_lens->get_default_far(), ideal_far_plane)); + _lens->set_far(std::max(_lens->get_default_far(), ideal_far_plane)); // And that the near plane is far enough forward, but if inside // the sphere, keep above 0. - PN_stdfloat ideal_near_plane = max(min_distance * 10, distance - radius); - _lens->set_near(min(_lens->get_default_near(), ideal_near_plane)); + PN_stdfloat ideal_near_plane = std::max(min_distance * 10, distance - radius); + _lens->set_near(std::min(_lens->get_default_near(), ideal_near_plane)); return DS_cont; } diff --git a/panda/src/testbed/test_map.cxx b/panda/src/testbed/test_map.cxx index 2c85f2c11a..97c0176a9d 100644 --- a/panda/src/testbed/test_map.cxx +++ b/panda/src/testbed/test_map.cxx @@ -16,6 +16,10 @@ #include "memoryUsage.h" #include "clockObject.h" +using std::cerr; +using std::cout; +using std::string; + class Alpha { public: Alpha(const string &str) : _str(str) { } @@ -36,7 +40,7 @@ public: string _str; }; -ostream &operator << (ostream &out, const Alpha &alpha) { +std::ostream &operator << (std::ostream &out, const Alpha &alpha) { return out << alpha._str; } @@ -113,7 +117,7 @@ test_performance() { static const int num_cycles = 10000; static const int num_reps = 3; - vector samples; + std::vector samples; samples.reserve(sample_size); for (int s = 0; s < sample_size; s++) { string key; diff --git a/panda/src/testbed/test_texmem.cxx b/panda/src/testbed/test_texmem.cxx index 977c1b0209..fd26a11508 100644 --- a/panda/src/testbed/test_texmem.cxx +++ b/panda/src/testbed/test_texmem.cxx @@ -49,7 +49,7 @@ event_T(const Event *, void *data) { static const int tex_x_size = 256; static const int tex_y_size = 256; - cerr << "Loading " << num_quads_side * num_quads_side << " textures at " + std::cerr << "Loading " << num_quads_side * num_quads_side << " textures at " << tex_x_size << ", " << tex_y_size << "\n"; PNMImage white_center(tex_x_size / 4, tex_y_size / 4); @@ -92,7 +92,7 @@ event_T(const Event *, void *data) { card.set_texture(tex); } } - cerr << "Done.\n"; + std::cerr << "Done.\n"; } int diff --git a/panda/src/text/config_text.cxx b/panda/src/text/config_text.cxx index 1bdcafcf09..77dd27beba 100644 --- a/panda/src/text/config_text.cxx +++ b/panda/src/text/config_text.cxx @@ -31,6 +31,8 @@ #error Buildsystem error: BUILDING_PANDA_TEXT not defined #endif +using std::wstring; + Configure(config_text); NotifyCategoryDef(text, ""); diff --git a/panda/src/text/dynamicTextFont.cxx b/panda/src/text/dynamicTextFont.cxx index 42c040c6ed..4eb4afc96a 100644 --- a/panda/src/text/dynamicTextFont.cxx +++ b/panda/src/text/dynamicTextFont.cxx @@ -226,7 +226,7 @@ clear() { * */ void DynamicTextFont:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { static const int max_glyph_name = 1024; char glyph_name[max_glyph_name]; @@ -972,7 +972,7 @@ slot_glyph(int character, int x_size, int y_size, PN_stdfloat advance) { void DynamicTextFont:: render_wireframe_contours(TextGlyph *glyph) { PT(GeomVertexData) vdata = new GeomVertexData - (string(), GeomVertexFormat::get_v3(), + (std::string(), GeomVertexFormat::get_v3(), Geom::UH_static); GeomVertexWriter vertex(vdata, InternalName::get_vertex()); @@ -1003,7 +1003,7 @@ render_wireframe_contours(TextGlyph *glyph) { void DynamicTextFont:: render_polygon_contours(TextGlyph *glyph, bool face, bool extrude) { PT(GeomVertexData) vdata = new GeomVertexData - (string(), GeomVertexFormat::get_v3n3(), + (std::string(), GeomVertexFormat::get_v3n3(), Geom::UH_static); GeomVertexWriter vertex(vdata, InternalName::get_vertex()); GeomVertexWriter normal(vdata, InternalName::get_normal()); diff --git a/panda/src/text/dynamicTextPage.cxx b/panda/src/text/dynamicTextPage.cxx index b48ba426db..7bfe582040 100644 --- a/panda/src/text/dynamicTextPage.cxx +++ b/panda/src/text/dynamicTextPage.cxx @@ -17,7 +17,6 @@ #ifdef HAVE_FREETYPE - TypeHandle DynamicTextPage::_type_handle; /** @@ -40,7 +39,7 @@ DynamicTextPage(DynamicTextFont *font, int page_number) : setup_2d_texture(_size[0], _size[1], T_unsigned_byte, font->get_tex_format()); // Assign a name to the Texture. - ostringstream strm; + std::ostringstream strm; strm << font->get_name() << "_" << page_number; set_name(strm.str()); @@ -215,7 +214,7 @@ find_hole(int &x, int &y, int x_size, int y_size) const { } next_x = overlap->_x + overlap->_x_size; - next_y = min(next_y, overlap->_y + overlap->_y_size); + next_y = std::min(next_y, overlap->_y + overlap->_y_size); nassertr(next_x > x, false); x = next_x; } diff --git a/panda/src/text/fontPool.cxx b/panda/src/text/fontPool.cxx index 6217be1bae..3f01243771 100644 --- a/panda/src/text/fontPool.cxx +++ b/panda/src/text/fontPool.cxx @@ -21,13 +21,15 @@ #include "loader.h" #include "lightMutexHolder.h" +using std::string; + FontPool *FontPool::_global_ptr = nullptr; /** * Lists the contents of the font pool to the indicated output stream. */ void FontPool:: -write(ostream &out) { +write(std::ostream &out) { get_ptr()->ns_list_contents(out); } @@ -211,7 +213,7 @@ ns_garbage_collect() { * The nonstatic implementation of list_contents(). */ void FontPool:: -ns_list_contents(ostream &out) const { +ns_list_contents(std::ostream &out) const { LightMutexHolder holder(_lock); out << _fonts.size() << " fonts:\n"; @@ -252,7 +254,7 @@ lookup_filename(const string &str, string &index_str, VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr(); vfs->resolve_filename(filename, get_model_path()); - ostringstream strm; + std::ostringstream strm; strm << filename << ":" << face_index; index_str = strm.str(); } diff --git a/panda/src/text/geomTextGlyph.cxx b/panda/src/text/geomTextGlyph.cxx index 6a02f2af16..ecd1a2173c 100644 --- a/panda/src/text/geomTextGlyph.cxx +++ b/panda/src/text/geomTextGlyph.cxx @@ -142,7 +142,7 @@ count_geom(const Geom *other) { * */ void GeomTextGlyph:: -output(ostream &out) const { +output(std::ostream &out) const { Geom::output(out); out << ", glyphs: ["; Glyphs::const_iterator gi; @@ -158,7 +158,7 @@ output(ostream &out) const { * */ void GeomTextGlyph:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { Geom::write(out, indent_level); indent(out, indent_level) << "Glyphs: ["; diff --git a/panda/src/text/staticTextFont.cxx b/panda/src/text/staticTextFont.cxx index 2f68c2dba8..c179120a14 100644 --- a/panda/src/text/staticTextFont.cxx +++ b/panda/src/text/staticTextFont.cxx @@ -114,7 +114,7 @@ make_copy() const { * */ void StaticTextFont:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << "StaticTextFont " << get_name() << "; " << _glyphs.size() << " characters available in font:\n"; @@ -280,7 +280,7 @@ find_character_gsets(PandaNode *root, CPT(Geom) &ch, CPT(Geom) &dot, void StaticTextFont:: find_characters(PandaNode *root, const RenderState *net_state) { CPT(RenderState) next_net_state = net_state->compose(root->get_state()); - string name = root->get_name(); + std::string name = root->get_name(); bool all_digits = !name.empty(); const char *p = name.c_str(); diff --git a/panda/src/text/textAssembler.cxx b/panda/src/text/textAssembler.cxx index e59b83a100..bb3a789504 100644 --- a/panda/src/text/textAssembler.cxx +++ b/panda/src/text/textAssembler.cxx @@ -40,6 +40,11 @@ #include #endif +using std::max; +using std::min; +using std::move; +using std::wstring; + // This is the factor by which CT_small scales the character down. static const PN_stdfloat small_accent_scale = 0.6f; @@ -827,7 +832,7 @@ scan_wtext(TextAssembler::TextString &output_string, // Now we have to encode the wstring into a string, for lookup in the // TextPropertiesManager. - string graphic_name = _encoder->encode_wtext(graphic_wname); + std::string graphic_name = _encoder->encode_wtext(graphic_wname); TextPropertiesManager *manager = TextPropertiesManager::get_global_ptr(); @@ -1628,7 +1633,7 @@ assemble_row(TextAssembler::TextRow &row, if (first_glyph != nullptr) { advance = first_glyph->get_advance() * advance_scale; if (!first_glyph->is_whitespace()) { - swap(placement._glyph, first_glyph); + std::swap(placement._glyph, first_glyph); placed_glyphs.push_back(placement); } } @@ -1638,7 +1643,7 @@ assemble_row(TextAssembler::TextRow &row, if (second_glyph != nullptr) { placement._xpos += advance * glyph_scale; advance += second_glyph->get_advance(); - swap(placement._glyph, second_glyph); + std::swap(placement._glyph, second_glyph); placed_glyphs.push_back(placement); } @@ -2414,7 +2419,7 @@ assign_append_to(GeomCollectorMap &geom_collector_map, int vi = primitive->get_vertex(i); // Attempt to insert number "vi" into the map. - pair added = vimap.insert(VertexIndexMap::value_type(vi, 0)); + std::pair added = vimap.insert(VertexIndexMap::value_type(vi, 0)); int new_vertex; if (added.second) { // The insert succeeded. That means this is the first time we have diff --git a/panda/src/text/textFont.cxx b/panda/src/text/textFont.cxx index 866743a5e8..bf6e9c5397 100644 --- a/panda/src/text/textFont.cxx +++ b/panda/src/text/textFont.cxx @@ -21,6 +21,10 @@ #include "geom.h" #include +using std::istream; +using std::ostream; +using std::string; + TypeHandle TextFont::_type_handle; /** diff --git a/panda/src/text/textGlyph.cxx b/panda/src/text/textGlyph.cxx index d68dce6371..bb8d998175 100644 --- a/panda/src/text/textGlyph.cxx +++ b/panda/src/text/textGlyph.cxx @@ -17,6 +17,9 @@ #include "geomVertexReader.h" #include "geomVertexWriter.h" +using std::max; +using std::min; + TypeHandle TextGlyph::_type_handle; /** @@ -252,7 +255,7 @@ make_quad_geom() { // rather than a single triangle strip, to avoid the bad vertex duplication // behavior with lots of two-triangle strips. PT(GeomVertexData) vdata = new GeomVertexData - (string(), GeomVertexFormat::get_v3t2(), Geom::UH_static); + (std::string(), GeomVertexFormat::get_v3t2(), Geom::UH_static); vdata->unclean_set_num_rows(4); PT(GeomTriangles) tris = new GeomTriangles(Geom::UH_static); diff --git a/panda/src/text/textNode.cxx b/panda/src/text/textNode.cxx index 7e0e687ada..19395788c3 100644 --- a/panda/src/text/textNode.cxx +++ b/panda/src/text/textNode.cxx @@ -49,6 +49,8 @@ #include +using std::string; + TypeHandle TextNode::_type_handle; PStatCollector TextNode::_text_generate_pcollector("*:Generate Text"); @@ -252,10 +254,10 @@ is_whitespace(wchar_t character) const { * like \1 or \3. */ PN_stdfloat TextNode:: -calc_width(const wstring &line) const { +calc_width(const std::wstring &line) const { PN_stdfloat width = 0.0f; - wstring::const_iterator si; + std::wstring::const_iterator si; for (si = line.begin(); si != line.end(); ++si) { width += calc_width(*si); } @@ -267,7 +269,7 @@ calc_width(const wstring &line) const { * */ void TextNode:: -output(ostream &out) const { +output(std::ostream &out) const { PandaNode::output(out); check_rebuild(); @@ -283,7 +285,7 @@ output(ostream &out) const { * */ void TextNode:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { PandaNode::write(out, indent_level); TextProperties::write(out, indent_level + 2); indent(out, indent_level + 2) @@ -346,7 +348,7 @@ generate() { CPT(TransformState) transform = TransformState::make_mat(mat); root->set_transform(transform); - wstring wtext = get_wtext(); + std::wstring wtext = get_wtext(); // Assemble the text. TextAssembler assembler(this); diff --git a/panda/src/text/textProperties.cxx b/panda/src/text/textProperties.cxx index dea089b612..42e7982638 100644 --- a/panda/src/text/textProperties.cxx +++ b/panda/src/text/textProperties.cxx @@ -253,7 +253,7 @@ add_properties(const TextProperties &other) { * */ void TextProperties:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { if (!is_any_specified()) { indent(out, indent_level) << "default properties\n"; @@ -408,7 +408,7 @@ get_text_state() const { state = state->add_attrib(CullBinAttrib::make(get_bin(), get_draw_order() + 2)); } - swap(_text_state, state); + std::swap(_text_state, state); return _text_state; } @@ -433,7 +433,7 @@ get_shadow_state() const { state = state->add_attrib(CullBinAttrib::make(get_bin(), get_draw_order() + 1)); } - swap(_shadow_state, state); + std::swap(_shadow_state, state); return _shadow_state; } @@ -466,16 +466,16 @@ load_default_font() { #else // The compiled-in Bam font requires creating a BamFile object to decode it. - string data((const char *)default_font_data, default_font_size); + std::string data((const char *)default_font_data, default_font_size); #ifdef HAVE_ZLIB // The font data is stored compressed; decompress it on-the-fly. - istringstream inz(data); + std::istringstream inz(data); IDecompressStream in(&inz, false); #else // The font data is stored uncompressed, so just load it. - istringstream in(data); + std::istringstream in(data); #endif // HAVE_ZLIB BamFile bam_file; diff --git a/panda/src/text/textPropertiesManager.cxx b/panda/src/text/textPropertiesManager.cxx index c057196e52..1c589499cc 100644 --- a/panda/src/text/textPropertiesManager.cxx +++ b/panda/src/text/textPropertiesManager.cxx @@ -14,6 +14,8 @@ #include "textPropertiesManager.h" #include "indent.h" +using std::string; + TextPropertiesManager *TextPropertiesManager::_global_ptr = nullptr; /** @@ -179,7 +181,7 @@ clear_graphic(const string &name) { * */ void TextPropertiesManager:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { Properties::const_iterator pi; for (pi = _properties.begin(); pi != _properties.end(); ++pi) { indent(out, indent_level) diff --git a/panda/src/tform/buttonThrower.cxx b/panda/src/tform/buttonThrower.cxx index 33c7150fb1..2446c1929a 100644 --- a/panda/src/tform/buttonThrower.cxx +++ b/panda/src/tform/buttonThrower.cxx @@ -21,6 +21,8 @@ #include "indent.h" #include "dcast.h" +using std::string; + TypeHandle ButtonThrower::_type_handle; @@ -204,7 +206,7 @@ clear_throw_buttons() { * Throw all events for button events found in the data element. */ void ButtonThrower:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { DataNode::write(out, indent_level); if (_throw_buttons_active) { indent(out, indent_level) @@ -310,7 +312,7 @@ do_general_event(const ButtonEvent &button_event, const string &button_name) { break; case ButtonEvent::T_keystroke: - event->add_parameter(wstring(1, button_event._keycode)); + event->add_parameter(std::wstring(1, button_event._keycode)); break; case ButtonEvent::T_candidate: diff --git a/panda/src/tform/driveInterface.cxx b/panda/src/tform/driveInterface.cxx index e9adfd8829..eb3433c557 100644 --- a/panda/src/tform/driveInterface.cxx +++ b/panda/src/tform/driveInterface.cxx @@ -25,6 +25,9 @@ #include "dataNodeTransmit.h" #include "dataGraphTraverser.h" +using std::max; +using std::min; + TypeHandle DriveInterface::_type_handle; const PN_stdfloat DriveInterface::_hpr_quantize = 0.001; @@ -95,7 +98,7 @@ operator < (const DriveInterface::KeyHeld &other) const { * */ DriveInterface:: -DriveInterface(const string &name) : +DriveInterface(const std::string &name) : MouseInterfaceNode(name) { _xy_input = define_input("xy", EventStoreVec2::get_class_type()); diff --git a/panda/src/tform/mouseInterfaceNode.cxx b/panda/src/tform/mouseInterfaceNode.cxx index 22031c4219..63c6c6cf87 100644 --- a/panda/src/tform/mouseInterfaceNode.cxx +++ b/panda/src/tform/mouseInterfaceNode.cxx @@ -23,7 +23,7 @@ TypeHandle MouseInterfaceNode::_type_handle; * */ MouseInterfaceNode:: -MouseInterfaceNode(const string &name) : +MouseInterfaceNode(const std::string &name) : DataNode(name) { _button_events_input = define_input("button_events", ButtonEventList::get_class_type()); diff --git a/panda/src/tform/mouseSubregion.cxx b/panda/src/tform/mouseSubregion.cxx index f342db85fe..89a5fcca94 100644 --- a/panda/src/tform/mouseSubregion.cxx +++ b/panda/src/tform/mouseSubregion.cxx @@ -20,7 +20,7 @@ TypeHandle MouseSubregion::_type_handle; * */ MouseSubregion:: -MouseSubregion(const string &name) : +MouseSubregion(const std::string &name) : MouseInterfaceNode(name) { _pixel_xy_input = define_input("pixel_xy", EventStoreVec2::get_class_type()); diff --git a/panda/src/tform/mouseWatcher.cxx b/panda/src/tform/mouseWatcher.cxx index 67dbee8591..c4b5c0a6e7 100644 --- a/panda/src/tform/mouseWatcher.cxx +++ b/panda/src/tform/mouseWatcher.cxx @@ -35,6 +35,8 @@ #include +using std::string; + TypeHandle MouseWatcher::_type_handle; /** @@ -487,7 +489,7 @@ note_activity() { * */ void MouseWatcher:: -output(ostream &out) const { +output(std::ostream &out) const { LightMutexHolder holder(_lock); DataNode::output(out); @@ -507,7 +509,7 @@ output(ostream &out) const { * */ void MouseWatcher:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << "MouseWatcher " << get_name() << ":\n"; MouseWatcherBase::write(out, indent_level + 2); @@ -625,7 +627,7 @@ set_current_regions(MouseWatcher::Regions ®ions) { // Queue up all the new regions so we can send the within patterns all at // once, after all of the without patterns have been thrown. - vector new_regions; + std::vector new_regions; bool any_changes = false; while (new_ri != regions.end() && old_ri != _current_regions.end()) { @@ -672,7 +674,7 @@ set_current_regions(MouseWatcher::Regions ®ions) { _current_regions.swap(regions); // And don't forget to throw all of the new regions' "within" events. - vector::const_iterator ri; + std::vector::const_iterator ri; for (ri = new_regions.begin(); ri != new_regions.end(); ++ri) { MouseWatcherRegion *new_region = (*ri); within_region(new_region, param); @@ -1059,7 +1061,7 @@ keystroke(int keycode) { * IME. */ void MouseWatcher:: -candidate(const wstring &candidate_string, size_t highlight_start, +candidate(const std::wstring &candidate_string, size_t highlight_start, size_t highlight_end, size_t cursor_pos) { nassertv(_lock.debug_is_locked()); diff --git a/panda/src/tform/mouseWatcherBase.cxx b/panda/src/tform/mouseWatcherBase.cxx index 46c1ae9743..6137ad9b3e 100644 --- a/panda/src/tform/mouseWatcherBase.cxx +++ b/panda/src/tform/mouseWatcherBase.cxx @@ -105,7 +105,7 @@ remove_region(MouseWatcherRegion *region) { * indeterminate. */ MouseWatcherRegion *MouseWatcherBase:: -find_region(const string &name) const { +find_region(const std::string &name) const { LightMutexHolder holder(_lock); for (MouseWatcherRegion *region : _regions) { @@ -169,7 +169,7 @@ get_region(size_t n) const { * */ void MouseWatcherBase:: -output(ostream &out) const { +output(std::ostream &out) const { out << "MouseWatcherGroup (" << _regions.size() << " regions)"; } @@ -177,7 +177,7 @@ output(ostream &out) const { * */ void MouseWatcherBase:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { LightMutexHolder holder(_lock); for (MouseWatcherRegion *region : _regions) { @@ -192,7 +192,7 @@ write(ostream &out, int indent_level) const { * scene graph for the window. */ void MouseWatcherBase:: -show_regions(const NodePath &render2d, const string &bin_name, int draw_order) { +show_regions(const NodePath &render2d, const std::string &bin_name, int draw_order) { LightMutexHolder holder(_lock); do_show_regions(render2d, bin_name, draw_order); } @@ -292,7 +292,7 @@ do_remove_region(MouseWatcherRegion *region) { * already held. */ void MouseWatcherBase:: -do_show_regions(const NodePath &render2d, const string &bin_name, +do_show_regions(const NodePath &render2d, const std::string &bin_name, int draw_order) { do_hide_regions(); _show_regions = true; diff --git a/panda/src/tform/mouseWatcherParameter.cxx b/panda/src/tform/mouseWatcherParameter.cxx index c1a697375e..9cc502694a 100644 --- a/panda/src/tform/mouseWatcherParameter.cxx +++ b/panda/src/tform/mouseWatcherParameter.cxx @@ -17,7 +17,7 @@ * */ void MouseWatcherParameter:: -output(ostream &out) const { +output(std::ostream &out) const { bool output_anything = false; if (has_button()) { diff --git a/panda/src/tform/mouseWatcherRegion.cxx b/panda/src/tform/mouseWatcherRegion.cxx index b9905a4715..2b7465041c 100644 --- a/panda/src/tform/mouseWatcherRegion.cxx +++ b/panda/src/tform/mouseWatcherRegion.cxx @@ -22,7 +22,7 @@ TypeHandle MouseWatcherRegion::_type_handle; * */ void MouseWatcherRegion:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_name() << " lrbt = " << _frame; } @@ -30,7 +30,7 @@ output(ostream &out) const { * */ void MouseWatcherRegion:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << get_name() << " lrbt = " << _frame << ", sort = " << _sort << "\n"; diff --git a/panda/src/tform/trackball.cxx b/panda/src/tform/trackball.cxx index 620b52950b..b56e1d47fe 100644 --- a/panda/src/tform/trackball.cxx +++ b/panda/src/tform/trackball.cxx @@ -34,7 +34,7 @@ TypeHandle Trackball::_type_handle; * */ Trackball:: -Trackball(const string &name) : +Trackball(const std::string &name) : MouseInterfaceNode(name) { _pixel_xy_input = define_input("pixel_xy", EventStoreVec2::get_class_type()); diff --git a/panda/src/tform/transform2sg.cxx b/panda/src/tform/transform2sg.cxx index 3f7137af56..61f734521f 100644 --- a/panda/src/tform/transform2sg.cxx +++ b/panda/src/tform/transform2sg.cxx @@ -23,7 +23,7 @@ TypeHandle Transform2SG::_type_handle; * */ Transform2SG:: -Transform2SG(const string &name) : +Transform2SG(const std::string &name) : DataNode(name) { _transform_input = define_input("transform", TransformState::get_class_type()); diff --git a/panda/src/tinydisplay/clip.cxx b/panda/src/tinydisplay/clip.cxx index da20a86adc..f2c6baa4ba 100644 --- a/panda/src/tinydisplay/clip.cxx +++ b/panda/src/tinydisplay/clip.cxx @@ -11,6 +11,8 @@ #define CLIP_ZMIN (1<<4) #define CLIP_ZMAX (1<<5) +using std::min; + void gl_transform_to_viewport(GLContext *c,GLVertex *v) { PN_stdfloat winv; diff --git a/panda/src/tinydisplay/store_pixel.cxx b/panda/src/tinydisplay/store_pixel.cxx index 07d5e7bdf4..4ffd8dde30 100644 --- a/panda/src/tinydisplay/store_pixel.cxx +++ b/panda/src/tinydisplay/store_pixel.cxx @@ -17,7 +17,7 @@ /* Pick up all of the generated code references to store_pixel.h. */ -#define STORE_PIX_CLAMP(x) (min((x), (unsigned int)0xffff)) +#define STORE_PIX_CLAMP(x) (std::min((x), (unsigned int)0xffff)) #include "store_pixel_table.h" #include "store_pixel_code.h" diff --git a/panda/src/tinydisplay/tinyGraphicsBuffer.cxx b/panda/src/tinydisplay/tinyGraphicsBuffer.cxx index 95599e9b22..ea8e8241a6 100644 --- a/panda/src/tinydisplay/tinyGraphicsBuffer.cxx +++ b/panda/src/tinydisplay/tinyGraphicsBuffer.cxx @@ -25,7 +25,7 @@ TypeHandle TinyGraphicsBuffer::_type_handle; */ TinyGraphicsBuffer:: TinyGraphicsBuffer(GraphicsEngine *engine, GraphicsPipe *pipe, - const string &name, + const std::string &name, const FrameBufferProperties &fb_prop, const WindowProperties &win_prop, int flags, diff --git a/panda/src/tinydisplay/tinyGraphicsStateGuardian.cxx b/panda/src/tinydisplay/tinyGraphicsStateGuardian.cxx index 782d461dc2..3717405893 100644 --- a/panda/src/tinydisplay/tinyGraphicsStateGuardian.cxx +++ b/panda/src/tinydisplay/tinyGraphicsStateGuardian.cxx @@ -40,6 +40,9 @@ #include "store_pixel_table.h" #include "graphicsEngine.h" +using std::max; +using std::min; + TypeHandle TinyGraphicsStateGuardian::_type_handle; PStatCollector TinyGraphicsStateGuardian::_vertices_immediate_pcollector("Vertices:Immediate mode"); @@ -1790,7 +1793,7 @@ do_issue_light() { */ void TinyGraphicsStateGuardian:: bind_light(PointLight *light_obj, const NodePath &light, int light_id) { - pair lookup = _plights.insert(Lights::value_type(light, GLLight())); + std::pair lookup = _plights.insert(Lights::value_type(light, GLLight())); GLLight *gl_light = &(*lookup.first).second; if (lookup.second) { // It's a brand new light. Define it. @@ -1842,7 +1845,7 @@ bind_light(PointLight *light_obj, const NodePath &light, int light_id) { */ void TinyGraphicsStateGuardian:: bind_light(DirectionalLight *light_obj, const NodePath &light, int light_id) { - pair lookup = _dlights.insert(Lights::value_type(light, GLLight())); + std::pair lookup = _dlights.insert(Lights::value_type(light, GLLight())); GLLight *gl_light = &(*lookup.first).second; if (lookup.second) { // It's a brand new light. Define it. @@ -1901,7 +1904,7 @@ bind_light(DirectionalLight *light_obj, const NodePath &light, int light_id) { */ void TinyGraphicsStateGuardian:: bind_light(Spotlight *light_obj, const NodePath &light, int light_id) { - pair lookup = _plights.insert(Lights::value_type(light, GLLight())); + std::pair lookup = _plights.insert(Lights::value_type(light, GLLight())); GLLight *gl_light = &(*lookup.first).second; if (lookup.second) { // It's a brand new light. Define it. @@ -2010,7 +2013,7 @@ do_issue_render_mode() { default: tinydisplay_cat.error() - << "Unknown render mode " << (int)target_render_mode->get_mode() << endl; + << "Unknown render mode " << (int)target_render_mode->get_mode() << std::endl; } } @@ -2043,7 +2046,7 @@ do_issue_rescale_normal() { default: tinydisplay_cat.error() - << "Unknown rescale_normal mode " << (int)mode << endl; + << "Unknown rescale_normal mode " << (int)mode << std::endl; } } @@ -2089,7 +2092,7 @@ do_issue_cull_face() { break; default: tinydisplay_cat.error() - << "invalid cull face mode " << (int)mode << endl; + << "invalid cull face mode " << (int)mode << std::endl; break; } } diff --git a/panda/src/tinydisplay/tinyOffscreenGraphicsPipe.cxx b/panda/src/tinydisplay/tinyOffscreenGraphicsPipe.cxx index 2e2c517fee..901d874c6d 100644 --- a/panda/src/tinydisplay/tinyOffscreenGraphicsPipe.cxx +++ b/panda/src/tinydisplay/tinyOffscreenGraphicsPipe.cxx @@ -43,7 +43,7 @@ TinyOffscreenGraphicsPipe:: * choose between several possible GraphicsPipes available on a particular * platform, so the name should be meaningful and unique for a given platform. */ -string TinyOffscreenGraphicsPipe:: +std::string TinyOffscreenGraphicsPipe:: get_interface_name() const { return "TinyPanda"; } @@ -61,7 +61,7 @@ pipe_constructor() { * Creates a new window on the pipe, if possible. */ PT(GraphicsOutput) TinyOffscreenGraphicsPipe:: -make_output(const string &name, +make_output(const std::string &name, const FrameBufferProperties &fb_prop, const WindowProperties &win_prop, int flags, diff --git a/panda/src/tinydisplay/tinyOsxGraphicsPipe.cxx b/panda/src/tinydisplay/tinyOsxGraphicsPipe.cxx index 6a55f05b94..349fad4398 100644 --- a/panda/src/tinydisplay/tinyOsxGraphicsPipe.cxx +++ b/panda/src/tinydisplay/tinyOsxGraphicsPipe.cxx @@ -48,7 +48,7 @@ TinyOsxGraphicsPipe:: * choose between several possible GraphicsPipes available on a particular * platform, so the name should be meaningful and unique for a given platform. */ -string TinyOsxGraphicsPipe:: +std::string TinyOsxGraphicsPipe:: get_interface_name() const { return "TinyPanda"; } @@ -181,7 +181,7 @@ release_data(void *info, const void *data, size_t size) { * only called from GraphicsEngine::make_output. */ PT(GraphicsOutput) TinyOsxGraphicsPipe:: -make_output(const string &name, +make_output(const std::string &name, const FrameBufferProperties &fb_prop, const WindowProperties &win_prop, int flags, diff --git a/panda/src/tinydisplay/tinySDLGraphicsPipe.cxx b/panda/src/tinydisplay/tinySDLGraphicsPipe.cxx index 7afe0953a4..8a8ef6c54b 100644 --- a/panda/src/tinydisplay/tinySDLGraphicsPipe.cxx +++ b/panda/src/tinydisplay/tinySDLGraphicsPipe.cxx @@ -55,7 +55,7 @@ TinySDLGraphicsPipe:: * choose between several possible GraphicsPipes available on a particular * platform, so the name should be meaningful and unique for a given platform. */ -string TinySDLGraphicsPipe:: +std::string TinySDLGraphicsPipe:: get_interface_name() const { return "TinyPanda"; } @@ -73,7 +73,7 @@ pipe_constructor() { * Creates a new window on the pipe, if possible. */ PT(GraphicsOutput) TinySDLGraphicsPipe:: -make_output(const string &name, +make_output(const std::string &name, const FrameBufferProperties &fb_prop, const WindowProperties &win_prop, int flags, diff --git a/panda/src/tinydisplay/tinySDLGraphicsWindow.cxx b/panda/src/tinydisplay/tinySDLGraphicsWindow.cxx index d0fe649b79..640adf3d5d 100644 --- a/panda/src/tinydisplay/tinySDLGraphicsWindow.cxx +++ b/panda/src/tinydisplay/tinySDLGraphicsWindow.cxx @@ -30,7 +30,7 @@ TypeHandle TinySDLGraphicsWindow::_type_handle; */ TinySDLGraphicsWindow:: TinySDLGraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe, - const string &name, + const std::string &name, const FrameBufferProperties &fb_prop, const WindowProperties &win_prop, int flags, diff --git a/panda/src/tinydisplay/tinyWinGraphicsPipe.cxx b/panda/src/tinydisplay/tinyWinGraphicsPipe.cxx index 6cfb2dc7c7..adc51e6c9f 100644 --- a/panda/src/tinydisplay/tinyWinGraphicsPipe.cxx +++ b/panda/src/tinydisplay/tinyWinGraphicsPipe.cxx @@ -43,7 +43,7 @@ TinyWinGraphicsPipe:: * choose between several possible GraphicsPipes available on a particular * platform, so the name should be meaningful and unique for a given platform. */ -string TinyWinGraphicsPipe:: +std::string TinyWinGraphicsPipe:: get_interface_name() const { return "TinyPanda"; } @@ -62,7 +62,7 @@ pipe_constructor() { * only called from GraphicsEngine::make_output. */ PT(GraphicsOutput) TinyWinGraphicsPipe:: -make_output(const string &name, +make_output(const std::string &name, const FrameBufferProperties &fb_prop, const WindowProperties &win_prop, int flags, diff --git a/panda/src/tinydisplay/tinyWinGraphicsWindow.cxx b/panda/src/tinydisplay/tinyWinGraphicsWindow.cxx index 85f1776ae5..ac16d45bf2 100644 --- a/panda/src/tinydisplay/tinyWinGraphicsWindow.cxx +++ b/panda/src/tinydisplay/tinyWinGraphicsWindow.cxx @@ -31,7 +31,7 @@ TypeHandle TinyWinGraphicsWindow::_type_handle; */ TinyWinGraphicsWindow:: TinyWinGraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe, - const string &name, + const std::string &name, const FrameBufferProperties &fb_prop, const WindowProperties &win_prop, int flags, diff --git a/panda/src/tinydisplay/tinyXGraphicsPipe.cxx b/panda/src/tinydisplay/tinyXGraphicsPipe.cxx index 7bbfbecf79..76cf30050e 100644 --- a/panda/src/tinydisplay/tinyXGraphicsPipe.cxx +++ b/panda/src/tinydisplay/tinyXGraphicsPipe.cxx @@ -27,7 +27,7 @@ TypeHandle TinyXGraphicsPipe::_type_handle; * */ TinyXGraphicsPipe:: -TinyXGraphicsPipe(const string &display) : x11GraphicsPipe(display) { +TinyXGraphicsPipe(const std::string &display) : x11GraphicsPipe(display) { } /** @@ -43,7 +43,7 @@ TinyXGraphicsPipe:: * choose between several possible GraphicsPipes available on a particular * platform, so the name should be meaningful and unique for a given platform. */ -string TinyXGraphicsPipe:: +std::string TinyXGraphicsPipe:: get_interface_name() const { return "TinyPanda"; } @@ -61,7 +61,7 @@ pipe_constructor() { * Creates a new window on the pipe, if possible. */ PT(GraphicsOutput) TinyXGraphicsPipe:: -make_output(const string &name, +make_output(const std::string &name, const FrameBufferProperties &fb_prop, const WindowProperties &win_prop, int flags, diff --git a/panda/src/tinydisplay/tinyXGraphicsWindow.cxx b/panda/src/tinydisplay/tinyXGraphicsWindow.cxx index 64f1a7c809..e84fa4d834 100644 --- a/panda/src/tinydisplay/tinyXGraphicsWindow.cxx +++ b/panda/src/tinydisplay/tinyXGraphicsWindow.cxx @@ -37,7 +37,7 @@ TypeHandle TinyXGraphicsWindow::_type_handle; */ TinyXGraphicsWindow:: TinyXGraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe, - const string &name, + const std::string &name, const FrameBufferProperties &fb_prop, const WindowProperties &win_prop, int flags, @@ -334,7 +334,7 @@ process_events() { if ((Atom)(event.xclient.data.l[0]) == _wm_delete_window) { // This is a message from the window manager indicating that the user // has requested to close the window. - string close_request_event = get_close_request_event(); + std::string close_request_event = get_close_request_event(); if (!close_request_event.empty()) { // In this case, the app has indicated a desire to intercept the // request and process it directly. diff --git a/panda/src/tinydisplay/zbuffer.cxx b/panda/src/tinydisplay/zbuffer.cxx index 45dbe1b0a2..ceab7790d8 100644 --- a/panda/src/tinydisplay/zbuffer.cxx +++ b/panda/src/tinydisplay/zbuffer.cxx @@ -24,6 +24,9 @@ int pixel_count_smooth_multitex2; int pixel_count_smooth_multitex3; #endif // DO_PSTATS +using std::max; +using std::min; + ZBuffer * ZB_open(int xsize, int ysize, int mode, int nb_colors, diff --git a/panda/src/vision/arToolKit.cxx b/panda/src/vision/arToolKit.cxx index 9d990cc26b..cb9a73508d 100644 --- a/panda/src/vision/arToolKit.cxx +++ b/panda/src/vision/arToolKit.cxx @@ -145,7 +145,7 @@ make(NodePath camera, const Filename ¶mfile, double marker_size) { } ARParam wparam; - string fn = paramfile.to_os_specific(); + std::string fn = paramfile.to_os_specific(); if( arParamLoad(fn.c_str(), 1, &wparam) < 0 ) { vision_cat.error() << "Cannot load ARToolKit camera config\n"; return 0; @@ -206,7 +206,7 @@ get_pattern(const Filename &filename) { return (*ptf).second; } - string fn = filename.to_os_specific(); + std::string fn = filename.to_os_specific(); int id = arLoadPatt(fn.c_str()); if (id < 0) { vision_cat.error() << "Could not load AR ToolKit Pattern: " << fn << "\n"; diff --git a/panda/src/vision/openCVTexture.cxx b/panda/src/vision/openCVTexture.cxx index e6deea17ea..702e0932af 100644 --- a/panda/src/vision/openCVTexture.cxx +++ b/panda/src/vision/openCVTexture.cxx @@ -43,7 +43,7 @@ TypeHandle OpenCVTexture::_type_handle; * Sets up the texture to read frames from a camera */ OpenCVTexture:: -OpenCVTexture(const string &name) : +OpenCVTexture(const std::string &name) : VideoTexture(name) { } @@ -70,7 +70,7 @@ consider_update() { } else { // Loop through the pages to see if there's any camera stream to update. Texture::CDWriter cdata(Texture::_cycler, false); - int max_z = max(cdata->_z_size, (int)_pages.size()); + int max_z = std::max(cdata->_z_size, (int)_pages.size()); for (int z = 0; z < max_z; ++z) { VideoPage &page = _pages[z]; if (!page._color.is_from_file() || !page._alpha.is_from_file()) { @@ -258,7 +258,7 @@ make_texture() { */ void OpenCVTexture:: do_update_frame(Texture::CData *cdata, int frame) { - int max_z = max(cdata->_z_size, (int)_pages.size()); + int max_z = std::max(cdata->_z_size, (int)_pages.size()); for (int z = 0; z < max_z; ++z) { do_update_frame(cdata, frame, z); } @@ -446,7 +446,7 @@ do_read_one(Texture::CData *cdata, */ bool OpenCVTexture:: do_load_one(Texture::CData *cdata, - const PNMImage &pnmimage, const string &name, + const PNMImage &pnmimage, const std::string &name, int z, int n, const LoaderOptions &options) { if (z <= (int)_pages.size()) { VideoPage &page = do_modify_page(cdata, z); @@ -581,7 +581,7 @@ bool OpenCVTexture::VideoStream:: read(const Filename &filename) { clear(); - string os_specific = filename.to_os_specific(); + std::string os_specific = filename.to_os_specific(); _capture = cvCaptureFromFile(os_specific.c_str()); if (_capture == nullptr) { return false; diff --git a/panda/src/vision/webcamVideoCursorV4L.cxx b/panda/src/vision/webcamVideoCursorV4L.cxx index 853f3e070f..95565f9428 100644 --- a/panda/src/vision/webcamVideoCursorV4L.cxx +++ b/panda/src/vision/webcamVideoCursorV4L.cxx @@ -30,7 +30,7 @@ extern "C" { TypeHandle WebcamVideoCursorV4L::_type_handle; -#define clamp(x) min(max(x, 0.0), 255.0) +#define clamp(x) std::min(std::max(x, 0.0), 255.0) INLINE static void yuv_to_bgr(unsigned char *dest, const unsigned char *src) { double y1 = (255 / 219.0) * (src[0] - 16); diff --git a/panda/src/vision/webcamVideoDS.cxx b/panda/src/vision/webcamVideoDS.cxx index 79510cf24d..531328b206 100644 --- a/panda/src/vision/webcamVideoDS.cxx +++ b/panda/src/vision/webcamVideoDS.cxx @@ -58,6 +58,9 @@ #include #include +using std::cerr; +using std::string; + /* * This used to work back when qedit.h still existed. The hacks served to * prevent it from including the defunct dxtrans.h. #pragma include_alias( diff --git a/panda/src/vision/webcamVideoOpenCV.cxx b/panda/src/vision/webcamVideoOpenCV.cxx index d4c68070fa..e7cadf8c69 100644 --- a/panda/src/vision/webcamVideoOpenCV.cxx +++ b/panda/src/vision/webcamVideoOpenCV.cxx @@ -46,7 +46,7 @@ WebcamVideoOpenCV:: WebcamVideoOpenCV(int camera_index) : _camera_index(camera_index) { - ostringstream strm; + std::ostringstream strm; strm << "OpenCV webcam " << _camera_index; set_name(strm.str()); } diff --git a/panda/src/vision/webcamVideoV4L.cxx b/panda/src/vision/webcamVideoV4L.cxx index 7d5636f4e0..bc6cad7a1b 100644 --- a/panda/src/vision/webcamVideoV4L.cxx +++ b/panda/src/vision/webcamVideoV4L.cxx @@ -94,7 +94,7 @@ TypeHandle WebcamVideoV4L::_type_handle; * */ void WebcamVideoV4L:: -add_options_for_size(int fd, const string &dev, const char *name, unsigned width, unsigned height, unsigned pixelformat) { +add_options_for_size(int fd, const std::string &dev, const char *name, unsigned width, unsigned height, unsigned pixelformat) { struct v4l2_frmivalenum frmivalenum; for (int k = 0;; k++) { memset(&frmivalenum, 0, sizeof frmivalenum); @@ -132,7 +132,7 @@ add_options_for_size(int fd, const string &dev, const char *name, unsigned width wc->_size_y = height; wc->_fps = fps; wc->_pformat = pixelformat; - wc->_pixel_format = string((char*) &pixelformat, 4); + wc->_pixel_format = std::string((char*) &pixelformat, 4); WebcamVideoV4L::_all_webcams.push_back(DCAST(WebcamVideo, wc)); } diff --git a/panda/src/vrpn/vrpnAnalog.cxx b/panda/src/vrpn/vrpnAnalog.cxx index 0934f7a8d8..d0d1b773ca 100644 --- a/panda/src/vrpn/vrpnAnalog.cxx +++ b/panda/src/vrpn/vrpnAnalog.cxx @@ -24,7 +24,7 @@ * */ VrpnAnalog:: -VrpnAnalog(const string &analog_name, vrpn_Connection *connection) : +VrpnAnalog(const std::string &analog_name, vrpn_Connection *connection) : _analog_name(analog_name) { _analog = new vrpn_Analog_Remote(_analog_name.c_str(), connection); @@ -74,7 +74,7 @@ unmark(VrpnAnalogDevice *device) { * */ void VrpnAnalog:: -output(ostream &out) const { +output(std::ostream &out) const { out << _analog_name; } @@ -82,7 +82,7 @@ output(ostream &out) const { * */ void VrpnAnalog:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << get_analog_name() << " (" << _devices.size() << " devices)\n"; diff --git a/panda/src/vrpn/vrpnAnalogDevice.cxx b/panda/src/vrpn/vrpnAnalogDevice.cxx index 00da1a2240..101f097c52 100644 --- a/panda/src/vrpn/vrpnAnalogDevice.cxx +++ b/panda/src/vrpn/vrpnAnalogDevice.cxx @@ -20,7 +20,7 @@ TypeHandle VrpnAnalogDevice::_type_handle; * */ VrpnAnalogDevice:: -VrpnAnalogDevice(VrpnClient *client, const string &device_name, +VrpnAnalogDevice(VrpnClient *client, const std::string &device_name, VrpnAnalog *vrpn_analog) : ClientAnalogDevice(client, device_name), _vrpn_analog(vrpn_analog) diff --git a/panda/src/vrpn/vrpnButton.cxx b/panda/src/vrpn/vrpnButton.cxx index cf17f6bade..71af239f88 100644 --- a/panda/src/vrpn/vrpnButton.cxx +++ b/panda/src/vrpn/vrpnButton.cxx @@ -24,7 +24,7 @@ * */ VrpnButton:: -VrpnButton(const string &button_name, vrpn_Connection *connection) : +VrpnButton(const std::string &button_name, vrpn_Connection *connection) : _button_name(button_name) { _button = new vrpn_Button_Remote(_button_name.c_str(), connection); @@ -74,7 +74,7 @@ unmark(VrpnButtonDevice *device) { * */ void VrpnButton:: -output(ostream &out) const { +output(std::ostream &out) const { out << _button_name; } @@ -82,7 +82,7 @@ output(ostream &out) const { * */ void VrpnButton:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << get_button_name() << " (" << _devices.size() << " devices)\n"; diff --git a/panda/src/vrpn/vrpnButtonDevice.cxx b/panda/src/vrpn/vrpnButtonDevice.cxx index a392bbce49..eb287d2f5e 100644 --- a/panda/src/vrpn/vrpnButtonDevice.cxx +++ b/panda/src/vrpn/vrpnButtonDevice.cxx @@ -20,7 +20,7 @@ TypeHandle VrpnButtonDevice::_type_handle; * */ VrpnButtonDevice:: -VrpnButtonDevice(VrpnClient *client, const string &device_name, +VrpnButtonDevice(VrpnClient *client, const std::string &device_name, VrpnButton *vrpn_button) : ClientButtonDevice(client, device_name), _vrpn_button(vrpn_button) diff --git a/panda/src/vrpn/vrpnClient.cxx b/panda/src/vrpn/vrpnClient.cxx index 068d7614a0..1fb7fcb4ff 100644 --- a/panda/src/vrpn/vrpnClient.cxx +++ b/panda/src/vrpn/vrpnClient.cxx @@ -26,6 +26,8 @@ #include "string_utils.h" #include "indent.h" +using std::string; + TypeHandle VrpnClient::_type_handle; /** @@ -63,7 +65,7 @@ VrpnClient:: * polling each frame. */ void VrpnClient:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << "VrpnClient, server " << _server_name << "\n"; diff --git a/panda/src/vrpn/vrpnDial.cxx b/panda/src/vrpn/vrpnDial.cxx index 57de1bd59c..5c06f797ee 100644 --- a/panda/src/vrpn/vrpnDial.cxx +++ b/panda/src/vrpn/vrpnDial.cxx @@ -24,7 +24,7 @@ * */ VrpnDial:: -VrpnDial(const string &dial_name, vrpn_Connection *connection) : +VrpnDial(const std::string &dial_name, vrpn_Connection *connection) : _dial_name(dial_name) { _dial = new vrpn_Dial_Remote(_dial_name.c_str(), connection); @@ -74,7 +74,7 @@ unmark(VrpnDialDevice *device) { * */ void VrpnDial:: -output(ostream &out) const { +output(std::ostream &out) const { out << _dial_name; } @@ -82,7 +82,7 @@ output(ostream &out) const { * */ void VrpnDial:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << get_dial_name() << " (" << _devices.size() << " devices)\n"; diff --git a/panda/src/vrpn/vrpnDialDevice.cxx b/panda/src/vrpn/vrpnDialDevice.cxx index 77be871f73..6331fb8a02 100644 --- a/panda/src/vrpn/vrpnDialDevice.cxx +++ b/panda/src/vrpn/vrpnDialDevice.cxx @@ -20,7 +20,7 @@ TypeHandle VrpnDialDevice::_type_handle; * */ VrpnDialDevice:: -VrpnDialDevice(VrpnClient *client, const string &device_name, +VrpnDialDevice(VrpnClient *client, const std::string &device_name, VrpnDial *vrpn_dial) : ClientDialDevice(client, device_name), _vrpn_dial(vrpn_dial) diff --git a/panda/src/vrpn/vrpnTracker.cxx b/panda/src/vrpn/vrpnTracker.cxx index 6427c6c392..6e4e196769 100644 --- a/panda/src/vrpn/vrpnTracker.cxx +++ b/panda/src/vrpn/vrpnTracker.cxx @@ -24,7 +24,7 @@ * */ VrpnTracker:: -VrpnTracker(const string &tracker_name, vrpn_Connection *connection) : +VrpnTracker(const std::string &tracker_name, vrpn_Connection *connection) : _tracker_name(tracker_name) { _tracker = new vrpn_Tracker_Remote(_tracker_name.c_str(), connection); @@ -76,7 +76,7 @@ unmark(VrpnTrackerDevice *device) { * */ void VrpnTracker:: -output(ostream &out) const { +output(std::ostream &out) const { out << _tracker_name; } @@ -84,7 +84,7 @@ output(ostream &out) const { * */ void VrpnTracker:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << get_tracker_name() << " (" << _devices.size() << " devices)\n"; diff --git a/panda/src/vrpn/vrpnTrackerDevice.cxx b/panda/src/vrpn/vrpnTrackerDevice.cxx index 5484df2c23..980f9cf77c 100644 --- a/panda/src/vrpn/vrpnTrackerDevice.cxx +++ b/panda/src/vrpn/vrpnTrackerDevice.cxx @@ -20,7 +20,7 @@ TypeHandle VrpnTrackerDevice::_type_handle; * */ VrpnTrackerDevice:: -VrpnTrackerDevice(VrpnClient *client, const string &device_name, +VrpnTrackerDevice(VrpnClient *client, const std::string &device_name, int sensor, VrpnTrackerDevice::DataType data_type, VrpnTracker *vrpn_tracker) : ClientTrackerDevice(client, device_name), diff --git a/panda/src/wgldisplay/wglGraphicsBuffer.cxx b/panda/src/wgldisplay/wglGraphicsBuffer.cxx index 868ff727b2..aacedf0ae3 100644 --- a/panda/src/wgldisplay/wglGraphicsBuffer.cxx +++ b/panda/src/wgldisplay/wglGraphicsBuffer.cxx @@ -28,7 +28,7 @@ TypeHandle wglGraphicsBuffer::_type_handle; */ wglGraphicsBuffer:: wglGraphicsBuffer(GraphicsEngine *engine, GraphicsPipe *pipe, - const string &name, + const std::string &name, const FrameBufferProperties &fb_prop, const WindowProperties &win_prop, int flags, diff --git a/panda/src/wgldisplay/wglGraphicsPipe.cxx b/panda/src/wgldisplay/wglGraphicsPipe.cxx index abffe1e1ee..1a55059dbd 100644 --- a/panda/src/wgldisplay/wglGraphicsPipe.cxx +++ b/panda/src/wgldisplay/wglGraphicsPipe.cxx @@ -66,7 +66,7 @@ wgl_make_current(HDC hdc, HGLRC hglrc, PStatCollector *collector) { * choose between several possible GraphicsPipes available on a particular * platform, so the name should be meaningful and unique for a given platform. */ -string wglGraphicsPipe:: +std::string wglGraphicsPipe:: get_interface_name() const { return "OpenGL"; } @@ -85,7 +85,7 @@ pipe_constructor() { * only called from GraphicsEngine::make_output. */ PT(GraphicsOutput) wglGraphicsPipe:: -make_output(const string &name, +make_output(const std::string &name, const FrameBufferProperties &fb_prop, const WindowProperties &win_prop, int flags, @@ -232,7 +232,7 @@ make_callback_gsg(GraphicsEngine *engine) { /** * Returns pfd_flags formatted as a string in a user-friendly way. */ -string wglGraphicsPipe:: +std::string wglGraphicsPipe:: format_pfd_flags(DWORD pfd_flags) { struct FlagDef { DWORD flag; @@ -255,7 +255,7 @@ format_pfd_flags(DWORD pfd_flags) { }; static const int num_flag_defs = sizeof(flag_def) / sizeof(FlagDef); - ostringstream out; + std::ostringstream out; const char *sep = ""; bool got_any = false; @@ -269,7 +269,7 @@ format_pfd_flags(DWORD pfd_flags) { } if (pfd_flags != 0 || !got_any) { - out << sep << hex << "0x" << pfd_flags << dec; + out << sep << std::hex << "0x" << pfd_flags << std::dec; } return out.str(); diff --git a/panda/src/wgldisplay/wglGraphicsStateGuardian.cxx b/panda/src/wgldisplay/wglGraphicsStateGuardian.cxx index 0d6f78ae1c..b1dc143da5 100644 --- a/panda/src/wgldisplay/wglGraphicsStateGuardian.cxx +++ b/panda/src/wgldisplay/wglGraphicsStateGuardian.cxx @@ -395,7 +395,7 @@ choose_pixel_format(const FrameBufferProperties &properties, max_pformats, pformat, (unsigned int *)&nformats)) { nformats = 0; } - nformats = min(nformats, max_pformats); + nformats = std::min(nformats, max_pformats); if (wgldisplay_cat.is_debug()) { wgldisplay_cat.debug() @@ -706,7 +706,7 @@ make_twindow() { if (!_twindow) { wgldisplay_cat.error() - << "CreateWindow() failed!" << endl; + << "CreateWindow() failed!" << std::endl; return false; } @@ -764,7 +764,7 @@ register_twindow_class() { if (!RegisterClass(&wc)) { wgldisplay_cat.error() - << "could not register window class!" << endl; + << "could not register window class!" << std::endl; return; } _twindow_class_registered = true; diff --git a/panda/src/wgldisplay/wglGraphicsWindow.cxx b/panda/src/wgldisplay/wglGraphicsWindow.cxx index fcba0b8bf4..d6a892ee30 100644 --- a/panda/src/wgldisplay/wglGraphicsWindow.cxx +++ b/panda/src/wgldisplay/wglGraphicsWindow.cxx @@ -28,7 +28,7 @@ TypeHandle wglGraphicsWindow::_type_handle; */ wglGraphicsWindow:: wglGraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe, - const string &name, + const std::string &name, const FrameBufferProperties &fb_prop, const WindowProperties &win_prop, int flags, @@ -386,7 +386,7 @@ print_pfd(PIXELFORMATDESCRIPTOR *pfd, char *msg) { wgldisplay_cat.debug() << msg << ", " << OGLDrvStrings[drvtype] << " driver\n" - << "PFD flags: 0x" << hex << pfd->dwFlags << dec << " (" + << "PFD flags: 0x" << std::hex << pfd->dwFlags << std::dec << " (" << PRINT_FLAG(GENERIC_ACCELERATED) << PRINT_FLAG(GENERIC_FORMAT) << PRINT_FLAG(DOUBLEBUFFER) @@ -403,15 +403,15 @@ print_pfd(PIXELFORMATDESCRIPTOR *pfd, char *msg) { << PRINT_FLAG(SUPPORT_DIRECTDRAW) << ")\n" << "PFD iPixelType: " << ((pfd->iPixelType==PFD_TYPE_RGBA) ? "PFD_TYPE_RGBA":"PFD_TYPE_COLORINDEX") - << endl + << std::endl << "PFD cColorBits: " << (DWORD)pfd->cColorBits << " R: " << (DWORD)pfd->cRedBits <<" G: " << (DWORD)pfd->cGreenBits - <<" B: " << (DWORD)pfd->cBlueBits << endl + <<" B: " << (DWORD)pfd->cBlueBits << std::endl << "PFD cAlphaBits: " << (DWORD)pfd->cAlphaBits << " DepthBits: " << (DWORD)pfd->cDepthBits <<" StencilBits: " << (DWORD)pfd->cStencilBits <<" AccumBits: " << (DWORD)pfd->cAccumBits - << endl; + << std::endl; } #endif diff --git a/panda/src/windisplay/winGraphicsWindow.cxx b/panda/src/windisplay/winGraphicsWindow.cxx index bd8244e880..eee4a30365 100644 --- a/panda/src/windisplay/winGraphicsWindow.cxx +++ b/panda/src/windisplay/winGraphicsWindow.cxx @@ -37,6 +37,9 @@ // Not used on Windows XP, but we still need to define it. #define TOUCH_COORD_TO_PIXEL(l) ((l) / 100) +using std::endl; +using std::wstring; + DECLARE_HANDLE(HTOUCHINPUT); #endif @@ -82,7 +85,7 @@ static PFN_CLOSETOUCHINPUTHANDLE pCloseTouchInputHandle = 0; */ WinGraphicsWindow:: WinGraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe, - const string &name, + const std::string &name, const FrameBufferProperties &fb_prop, const WindowProperties &win_prop, int flags, @@ -257,7 +260,7 @@ set_properties_now(WindowProperties &properties) { } if (properties.has_title()) { - string title = properties.get_title(); + std::string title = properties.get_title(); _properties.set_title(title); TextEncoder encoder; wstring title_w = encoder.decode_text(title); @@ -1359,7 +1362,7 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { // This is a message from the system indicating that the user has // requested to close the window (e.g. alt-f4). { - string close_request_event = get_close_request_event(); + std::string close_request_event = get_close_request_event(); if (!close_request_event.empty()) { // In this case, the app has indicated a desire to intercept the // request and process it directly. @@ -1724,8 +1727,8 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { size_t num_chars = result_size / sizeof(wchar_t); _input_devices[0].candidate(wstring(ime_buffer, num_chars), - min(cursor_pos, delta_start), - max(cursor_pos, delta_start), + std::min(cursor_pos, delta_start), + std::max(cursor_pos, delta_start), cursor_pos); } ImmReleaseContext(hwnd, hIMC); @@ -2829,7 +2832,7 @@ register_window_class(const WindowProperties &props) { wclass_name << L"WinGraphicsWindow" << _window_class_index; wcreg._name = wclass_name.str(); - pair found = _window_classes.insert(wcreg); + std::pair found = _window_classes.insert(wcreg); const WindowClass &wclass = (*found.first); if (!found.second) { diff --git a/panda/src/x11display/x11GraphicsPipe.cxx b/panda/src/x11display/x11GraphicsPipe.cxx index 494da180da..2348d58706 100644 --- a/panda/src/x11display/x11GraphicsPipe.cxx +++ b/panda/src/x11display/x11GraphicsPipe.cxx @@ -33,12 +33,12 @@ LightReMutex x11GraphicsPipe::_x_mutex; * */ x11GraphicsPipe:: -x11GraphicsPipe(const string &display) : +x11GraphicsPipe(const std::string &display) : _have_xrandr(false), _xcursor_size(-1), _XF86DGADirectVideo(nullptr) { - string display_spec = display; + std::string display_spec = display; if (display_spec.empty()) { display_spec = display_cfg; } diff --git a/panda/src/x11display/x11GraphicsWindow.cxx b/panda/src/x11display/x11GraphicsWindow.cxx index 5fb290e315..0187139828 100644 --- a/panda/src/x11display/x11GraphicsWindow.cxx +++ b/panda/src/x11display/x11GraphicsWindow.cxx @@ -38,6 +38,10 @@ #include #endif +using std::istream; +using std::ostringstream; +using std::string; + struct _XcursorFile { void *closure; int (*read)(XcursorFile *, unsigned char *, int); @@ -1912,7 +1916,7 @@ map_button(KeySym key) const { } if (x11display_cat.is_debug()) { x11display_cat.debug() - << "Unrecognized keysym 0x" << hex << key << dec << "\n"; + << "Unrecognized keysym 0x" << std::hex << key << std::dec << "\n"; } return ButtonHandle::none(); } diff --git a/pandatool/src/assimp/assimpLoader.cxx b/pandatool/src/assimp/assimpLoader.cxx index 4694e89217..61c7514aa6 100644 --- a/pandatool/src/assimp/assimpLoader.cxx +++ b/pandatool/src/assimp/assimpLoader.cxx @@ -41,6 +41,10 @@ #include "postprocess.h" +using std::ostringstream; +using std::stringstream; +using std::string; + struct BoneWeight { CPT(JointVertexTransform) joint_vertex_xform; float weight; diff --git a/pandatool/src/assimp/loaderFileTypeAssimp.cxx b/pandatool/src/assimp/loaderFileTypeAssimp.cxx index 3f344b2674..73c27ee7d4 100644 --- a/pandatool/src/assimp/loaderFileTypeAssimp.cxx +++ b/pandatool/src/assimp/loaderFileTypeAssimp.cxx @@ -15,6 +15,8 @@ #include "config_assimp.h" #include "assimpLoader.h" +using std::string; + TypeHandle LoaderFileTypeAssimp::_type_handle; /** diff --git a/pandatool/src/assimp/pandaIOStream.cxx b/pandatool/src/assimp/pandaIOStream.cxx index e4dde48e79..ad610d608f 100644 --- a/pandatool/src/assimp/pandaIOStream.cxx +++ b/pandatool/src/assimp/pandaIOStream.cxx @@ -13,12 +13,13 @@ #include "pandaIOStream.h" +using std::ios; /** * */ PandaIOStream:: -PandaIOStream(istream &stream) : _istream(stream) { +PandaIOStream(std::istream &stream) : _istream(stream) { } /** @@ -26,9 +27,9 @@ PandaIOStream(istream &stream) : _istream(stream) { */ size_t PandaIOStream:: FileSize() const { - streampos cur = _istream.tellg(); + std::streampos cur = _istream.tellg(); _istream.seekg(0, ios::end); - streampos end = _istream.tellg(); + std::streampos end = _istream.tellg(); _istream.seekg(cur, ios::beg); return end; } diff --git a/pandatool/src/assimp/pandaIOSystem.cxx b/pandatool/src/assimp/pandaIOSystem.cxx index ff400bd285..87dea240d2 100644 --- a/pandatool/src/assimp/pandaIOSystem.cxx +++ b/pandatool/src/assimp/pandaIOSystem.cxx @@ -72,7 +72,7 @@ Open(const char *file, const char *mode) { Filename fn = Filename::from_os_specific(file); if (mode[0] == 'r') { - istream *stream = _vfs->open_read_file(file, true); + std::istream *stream = _vfs->open_read_file(file, true); if (stream == nullptr) { return nullptr; } diff --git a/pandatool/src/bam/bamInfo.cxx b/pandatool/src/bam/bamInfo.cxx index bda00908a5..a30a5066dd 100644 --- a/pandatool/src/bam/bamInfo.cxx +++ b/pandatool/src/bam/bamInfo.cxx @@ -234,7 +234,7 @@ describe_session(RecorderHeader *header, const BamInfo::Objects &objects) { strftime(time_buffer, 1024, "%c", localtime(&header->_start_time)); - pset recorders; + pset recorders; double last_timestamp = 0.0; for (size_t i = 1; i < objects.size(); i++) { @@ -256,7 +256,7 @@ describe_session(RecorderHeader *header, const BamInfo::Objects &objects) { << " secs, " << objects.size() - 1 << " frames, " << time_buffer << ".\n" << "Recorders:"; - for (pset::iterator ni = recorders.begin(); + for (pset::iterator ni = recorders.begin(); ni != recorders.end(); ++ni) { nout << " " << (*ni); diff --git a/pandatool/src/bam/eggToBam.cxx b/pandatool/src/bam/eggToBam.cxx index 7522a70cc6..a7e760d29c 100644 --- a/pandatool/src/bam/eggToBam.cxx +++ b/pandatool/src/bam/eggToBam.cxx @@ -246,7 +246,7 @@ run() { if (_ctex_quality != "default") { // Override the user's config file with the command-line parameter for // texture compression. - string prc = "texture-quality-level " + _ctex_quality; + std::string prc = "texture-quality-level " + _ctex_quality; load_prc_file_data("prc", prc); } @@ -442,7 +442,7 @@ bool EggToBam:: make_buffer() { if (!_load_display.empty()) { // Override the user's config file with the command-line parameter. - string prc = "load-display " + _load_display; + std::string prc = "load-display " + _load_display; load_prc_file_data("prc", prc); } diff --git a/pandatool/src/bam/ptsToBam.cxx b/pandatool/src/bam/ptsToBam.cxx index 538022bfbc..0059df8616 100644 --- a/pandatool/src/bam/ptsToBam.cxx +++ b/pandatool/src/bam/ptsToBam.cxx @@ -22,6 +22,8 @@ #include "string_utils.h" #include "config_egg2pg.h" +using std::string; + /** * */ @@ -71,7 +73,7 @@ run() { _num_points_expected = 0; _num_points_found = 0; _num_points_added = 0; - _decimate_factor = 1.0 / max(1.0, _decimate_divisor); + _decimate_factor = 1.0 / std::max(1.0, _decimate_divisor); _line_number = 0; _point_number = 0; _decimated_point_number = 0.0; @@ -215,7 +217,7 @@ close_vertex_data() { int num_vertices = _data->get_num_rows(); int vertices_so_far = 0; while (num_vertices > 0) { - int this_num_vertices = min(num_vertices, (int)egg_max_indices); + int this_num_vertices = std::min(num_vertices, (int)egg_max_indices); PT(GeomPrimitive) points = new GeomPoints(GeomEnums::UH_static); points->add_consecutive_vertices(vertices_so_far, this_num_vertices); geom->add_primitive(points); diff --git a/pandatool/src/converter/eggToSomethingConverter.cxx b/pandatool/src/converter/eggToSomethingConverter.cxx index 1e1629fe1b..0f357883c8 100644 --- a/pandatool/src/converter/eggToSomethingConverter.cxx +++ b/pandatool/src/converter/eggToSomethingConverter.cxx @@ -54,9 +54,9 @@ set_egg_data(EggData *egg_data) { * Returns a space-separated list of extension, in addition to the one * returned by get_extension(), that are recognized by this converter. */ -string EggToSomethingConverter:: +std::string EggToSomethingConverter:: get_additional_extensions() const { - return string(); + return std::string(); } /** diff --git a/pandatool/src/converter/somethingToEggConverter.cxx b/pandatool/src/converter/somethingToEggConverter.cxx index 58c914b7f5..8911021a0a 100644 --- a/pandatool/src/converter/somethingToEggConverter.cxx +++ b/pandatool/src/converter/somethingToEggConverter.cxx @@ -71,9 +71,9 @@ set_egg_data(EggData *egg_data) { * Returns a space-separated list of extension, in addition to the one * returned by get_extension(), that are recognized by this converter. */ -string SomethingToEggConverter:: +std::string SomethingToEggConverter:: get_additional_extensions() const { - return string(); + return std::string(); } /** diff --git a/pandatool/src/cvscopy/cvsCopy.cxx b/pandatool/src/cvscopy/cvsCopy.cxx index cc970748a0..17dd07eb66 100644 --- a/pandatool/src/cvscopy/cvsCopy.cxx +++ b/pandatool/src/cvscopy/cvsCopy.cxx @@ -17,6 +17,8 @@ #include "pnotify.h" #include +using std::string; + /** * */ diff --git a/pandatool/src/cvscopy/cvsSourceDirectory.cxx b/pandatool/src/cvscopy/cvsSourceDirectory.cxx index 9ccacc3afd..0eb741044d 100644 --- a/pandatool/src/cvscopy/cvsSourceDirectory.cxx +++ b/pandatool/src/cvscopy/cvsSourceDirectory.cxx @@ -17,6 +17,8 @@ #include "pnotify.h" +using std::string; + /** * */ diff --git a/pandatool/src/cvscopy/cvsSourceTree.cxx b/pandatool/src/cvscopy/cvsSourceTree.cxx index 69b483fa3c..8511afac6a 100644 --- a/pandatool/src/cvscopy/cvsSourceTree.cxx +++ b/pandatool/src/cvscopy/cvsSourceTree.cxx @@ -28,6 +28,8 @@ #include // for chdir #endif +using std::string; + bool CVSSourceTree::_got_start_fullpath = false; Filename CVSSourceTree::_start_fullpath; @@ -440,7 +442,7 @@ string CVSSourceTree:: prompt(const string &message) { nout << std::flush; while (true) { - cerr << message << std::flush; + std::cerr << message << std::flush; std::string response; std::getline(std::cin, response); diff --git a/pandatool/src/daeegg/daeCharacter.cxx b/pandatool/src/daeegg/daeCharacter.cxx index 3b98fa80a7..39aee067bd 100644 --- a/pandatool/src/daeegg/daeCharacter.cxx +++ b/pandatool/src/daeegg/daeCharacter.cxx @@ -76,7 +76,7 @@ bind_joints(JointMap &joint_map) { // Record the bind pose for each joint. for (size_t j = 0; j < num_joints; ++j) { const FCDSkinControllerJoint *skin_joint = _skin_controller->GetJoint(j); - string sid = FROM_FSTRING(skin_joint->GetId()); + std::string sid = FROM_FSTRING(skin_joint->GetId()); LMatrix4d bind_pose; bind_pose.invert_from(DAEToEggConverter::convert_matrix( skin_joint->GetBindPoseInverse())); @@ -126,7 +126,7 @@ adjust_joints(FCDSceneNode *node, const JointMap &joint_map, LMatrix4d this_transform = transform; if (node->IsJoint()) { - string sid = FROM_FSTRING(node->GetSubId()); + std::string sid = FROM_FSTRING(node->GetSubId()); JointMap::const_iterator ji = joint_map.find(sid); if (ji != joint_map.end()) { @@ -252,7 +252,7 @@ build_table(EggTable *parent, FCDSceneNode* node, const pset &keys) { return; } - string node_id = FROM_FSTRING(node->GetDaeId()); + std::string node_id = FROM_FSTRING(node->GetDaeId()); PT(EggTable) table = new EggTable(node_id); table->set_table_type(EggTable::TT_table); parent->add_child(table); diff --git a/pandatool/src/daeegg/daeMaterials.cxx b/pandatool/src/daeegg/daeMaterials.cxx index 0c15fe819d..6aab105cc7 100644 --- a/pandatool/src/daeegg/daeMaterials.cxx +++ b/pandatool/src/daeegg/daeMaterials.cxx @@ -25,6 +25,9 @@ #include "filename.h" #include "string_utils.h" +using std::endl; +using std::string; + TypeHandle DaeMaterials::_type_handle; // luminance function, based on the ISOCIE color standards see ITU-R diff --git a/pandatool/src/daeegg/daeToEggConverter.cxx b/pandatool/src/daeegg/daeToEggConverter.cxx index f054643d7b..00c20a36da 100644 --- a/pandatool/src/daeegg/daeToEggConverter.cxx +++ b/pandatool/src/daeegg/daeToEggConverter.cxx @@ -48,6 +48,9 @@ #include "FCDocument/FCDGeometryPolygonsInput.h" #endif +using std::endl; +using std::string; + /** * */ diff --git a/pandatool/src/daeegg/pre_fcollada_include.h b/pandatool/src/daeegg/pre_fcollada_include.h index 18cbe7a45d..59ad054c2a 100644 --- a/pandatool/src/daeegg/pre_fcollada_include.h +++ b/pandatool/src/daeegg/pre_fcollada_include.h @@ -38,4 +38,8 @@ #define NO_LIBXML #define FCOLLADA_NOMINMAX +// FCollada does use global min/max. +using std::min; +using std::max; + #endif diff --git a/pandatool/src/daeprogs/daeToEgg.cxx b/pandatool/src/daeprogs/daeToEgg.cxx index c3ba781361..e00747344a 100644 --- a/pandatool/src/daeprogs/daeToEgg.cxx +++ b/pandatool/src/daeprogs/daeToEgg.cxx @@ -49,7 +49,7 @@ void DAEToEgg:: run() { if (_animation_convert != AC_both && _animation_convert != AC_none && _animation_convert != AC_chan && _animation_convert != AC_model) { - cerr << "Unsupported animation convert option.\n"; + std::cerr << "Unsupported animation convert option.\n"; exit(1); } diff --git a/pandatool/src/daeprogs/eggToDAE.cxx b/pandatool/src/daeprogs/eggToDAE.cxx index cc3d9facf4..b9652e698f 100644 --- a/pandatool/src/daeprogs/eggToDAE.cxx +++ b/pandatool/src/daeprogs/eggToDAE.cxx @@ -28,6 +28,8 @@ #define FROM_MAT4(v) (FMMatrix44(v.get_data())) #define FROM_FSTRING(fs) (fs.c_str()) +using std::cerr; + /** * */ diff --git a/pandatool/src/dxf/dxfFile.cxx b/pandatool/src/dxf/dxfFile.cxx index 0637c97d39..f5bb6e0912 100644 --- a/pandatool/src/dxf/dxfFile.cxx +++ b/pandatool/src/dxf/dxfFile.cxx @@ -15,6 +15,10 @@ #include "string_utils.h" #include "virtualFileSystem.h" +using std::istream; +using std::ostream; +using std::string; + DXFFile::Color DXFFile::_colors[DXF_num_colors] = { { 1, 1, 1 }, // Color 0 is not used. { 1, 0, 0 }, // Color 1 = Red diff --git a/pandatool/src/dxf/dxfLayer.cxx b/pandatool/src/dxf/dxfLayer.cxx index 5ffc96a5cc..6803cc179e 100644 --- a/pandatool/src/dxf/dxfLayer.cxx +++ b/pandatool/src/dxf/dxfLayer.cxx @@ -18,7 +18,7 @@ * */ DXFLayer:: -DXFLayer(const string &name) : Namable(name) { +DXFLayer(const std::string &name) : Namable(name) { } /** diff --git a/pandatool/src/dxf/dxfLayerMap.cxx b/pandatool/src/dxf/dxfLayerMap.cxx index 447b27e8ca..d2049c8191 100644 --- a/pandatool/src/dxf/dxfLayerMap.cxx +++ b/pandatool/src/dxf/dxfLayerMap.cxx @@ -22,7 +22,7 @@ * this function to create a specialized time, if desired. */ DXFLayer *DXFLayerMap:: -get_layer(const string &name, DXFFile *dxffile) { +get_layer(const std::string &name, DXFFile *dxffile) { iterator lmi; lmi = find(name); if (lmi != end()) { diff --git a/pandatool/src/dxfegg/dxfToEggConverter.cxx b/pandatool/src/dxfegg/dxfToEggConverter.cxx index 3620f96abd..6ba6411940 100644 --- a/pandatool/src/dxfegg/dxfToEggConverter.cxx +++ b/pandatool/src/dxfegg/dxfToEggConverter.cxx @@ -50,7 +50,7 @@ make_copy() { /** * Returns the English name of the file type this converter supports. */ -string DXFToEggConverter:: +std::string DXFToEggConverter:: get_name() const { return "DXF"; } @@ -58,7 +58,7 @@ get_name() const { /** * Returns the common extension of the file type this converter supports. */ -string DXFToEggConverter:: +std::string DXFToEggConverter:: get_extension() const { return "dxf"; } @@ -92,7 +92,7 @@ convert_file(const Filename &filename) { * */ DXFLayer *DXFToEggConverter:: -new_layer(const string &name) { +new_layer(const std::string &name) { return new DXFToEggLayer(name, get_egg_data()); } diff --git a/pandatool/src/dxfegg/dxfToEggLayer.cxx b/pandatool/src/dxfegg/dxfToEggLayer.cxx index 333cd5a69e..3ecb915efb 100644 --- a/pandatool/src/dxfegg/dxfToEggLayer.cxx +++ b/pandatool/src/dxfegg/dxfToEggLayer.cxx @@ -26,7 +26,7 @@ * */ DXFToEggLayer:: -DXFToEggLayer(const string &name, EggGroupNode *parent) : DXFLayer(name) { +DXFToEggLayer(const std::string &name, EggGroupNode *parent) : DXFLayer(name) { _group = new EggGroup(name); parent->add_child(_group); _vpool = new EggVertexPool(name); diff --git a/pandatool/src/dxfprogs/eggToDXF.cxx b/pandatool/src/dxfprogs/eggToDXF.cxx index e3fb8a85d5..412b815601 100644 --- a/pandatool/src/dxfprogs/eggToDXF.cxx +++ b/pandatool/src/dxfprogs/eggToDXF.cxx @@ -52,7 +52,7 @@ run() { // uniquify_names("layer", _layers.begin(), _layers.end()); - ostream &out = get_output(); + std::ostream &out = get_output(); // Autodesk says we don't need the header, but some DXF-reading programs // might get confused if it's missing. We'll write an empty header. @@ -107,7 +107,7 @@ get_layers(EggGroupNode *group) { * gets written later, in write_entities(). */ void EggToDXF:: -write_tables(ostream &out) { +write_tables(std::ostream &out) { out << "0\nSECTION\n" << "2\nTABLES\n" // Begin TABLES section. << "0\nTABLE\n" @@ -127,7 +127,7 @@ write_tables(ostream &out) { * Writes out the "entities", e.g. polygons, defined for all layers. */ void EggToDXF:: -write_entities(ostream &out) { +write_entities(std::ostream &out) { out << "0\nSECTION\n" << "2\nENTITIES\n"; // Begin ENTITIES section. diff --git a/pandatool/src/dxfprogs/eggToDXFLayer.cxx b/pandatool/src/dxfprogs/eggToDXFLayer.cxx index c10c51f862..6922f0b8a6 100644 --- a/pandatool/src/dxfprogs/eggToDXFLayer.cxx +++ b/pandatool/src/dxfprogs/eggToDXFLayer.cxx @@ -19,6 +19,8 @@ #include "eggPolygon.h" #include "dcast.h" +using std::ostream; + /** * */ diff --git a/pandatool/src/egg-mkfont/eggMakeFont.cxx b/pandatool/src/egg-mkfont/eggMakeFont.cxx index 8ae277126b..4efa4a5ad5 100644 --- a/pandatool/src/egg-mkfont/eggMakeFont.cxx +++ b/pandatool/src/egg-mkfont/eggMakeFont.cxx @@ -32,6 +32,8 @@ #include +using std::string; + /** * */ @@ -424,7 +426,7 @@ run() { _bg[0], _bg[1], _bg[2], _bg[3], _palette_size[0], _palette_size[1], 100.0 / _palettize_scale_factor); - istringstream txa_script(buffer); + std::istringstream txa_script(buffer); pal->read_txa_file(txa_script, "default script"); pal->all_params_set(); diff --git a/pandatool/src/egg-mkfont/rangeDescription.cxx b/pandatool/src/egg-mkfont/rangeDescription.cxx index bedfc086ea..2833f53359 100644 --- a/pandatool/src/egg-mkfont/rangeDescription.cxx +++ b/pandatool/src/egg-mkfont/rangeDescription.cxx @@ -15,6 +15,8 @@ #include "string_utils.h" #include "pnotify.h" +using std::string; + /** * */ @@ -71,7 +73,7 @@ parse_parameter(const string ¶m) { * */ void RangeDescription:: -output(ostream &out) const { +output(std::ostream &out) const { bool first_time = true; RangeList::const_iterator ri; for (ri = _range_list.begin(); ri != _range_list.end(); ++ri) { diff --git a/pandatool/src/egg-optchar/eggOptchar.cxx b/pandatool/src/egg-optchar/eggOptchar.cxx index c7027ec9ec..182b657968 100644 --- a/pandatool/src/egg-optchar/eggOptchar.cxx +++ b/pandatool/src/egg-optchar/eggOptchar.cxx @@ -34,6 +34,10 @@ #include +using std::cout; +using std::setw; +using std::string; + /** * */ diff --git a/pandatool/src/egg-palettize/eggPalettize.cxx b/pandatool/src/egg-palettize/eggPalettize.cxx index e81290f06c..afa7fa00b7 100644 --- a/pandatool/src/egg-palettize/eggPalettize.cxx +++ b/pandatool/src/egg-palettize/eggPalettize.cxx @@ -696,7 +696,7 @@ run() { bool okflag = true; if (_got_txa_script) { - istringstream txa_script(_txa_script); + std::istringstream txa_script(_txa_script); pal->read_txa_file(txa_script, "command line"); } else { @@ -757,13 +757,13 @@ run() { // And process the egg files named for addition. bool all_eggs_valid = true; - string egg_comment = get_exec_command(); + std::string egg_comment = get_exec_command(); Eggs::const_iterator ei; for (ei = _eggs.begin(); ei != _eggs.end(); ++ei) { EggData *egg_data = (*ei); Filename source_filename = egg_data->get_egg_filename(); Filename dest_filename = get_output_filename(source_filename); - string name = source_filename.get_basename(); + std::string name = source_filename.get_basename(); EggFile *egg_file = pal->get_egg_file(name); if (!egg_file->from_command_line(egg_data, source_filename, dest_filename, @@ -834,7 +834,7 @@ run() { // state file into place. We do this in case the user interrupts us (or // we core dump) before we're done; that way we won't leave the state file // incompletely written. - string dirname = state_filename.get_dirname(); + std::string dirname = state_filename.get_dirname(); if (dirname.empty()) { dirname = "."; } diff --git a/pandatool/src/egg-palettize/txaFileFilter.cxx b/pandatool/src/egg-palettize/txaFileFilter.cxx index 980dc7d114..f8c20cfb0c 100644 --- a/pandatool/src/egg-palettize/txaFileFilter.cxx +++ b/pandatool/src/egg-palettize/txaFileFilter.cxx @@ -52,7 +52,7 @@ post_load(Texture *tex) { } TextureImage tex_image; - string name = tex->get_filename().get_basename_wo_extension(); + std::string name = tex->get_filename().get_basename_wo_extension(); tex_image.set_name(name); SourceTextureImage *source = tex_image.get_source @@ -131,7 +131,7 @@ read_txa_file() { << "Filename " << filename << " not found.\n"; } else { filename.set_text(); - istream *ifile = vfs->open_read_file(filename, true); + std::istream *ifile = vfs->open_read_file(filename, true); if (ifile == nullptr) { txafile_cat.warning() << "Filename " << filename << " cannot be read.\n"; diff --git a/pandatool/src/egg-qtess/eggQtess.cxx b/pandatool/src/egg-qtess/eggQtess.cxx index fea4d09344..37473557bf 100644 --- a/pandatool/src/egg-qtess/eggQtess.cxx +++ b/pandatool/src/egg-qtess/eggQtess.cxx @@ -155,9 +155,9 @@ run() { if (_total_tris != 0) { // Whatever number of triangles we have unaccounted for, assign to the // default bucket. - int extra_tris = max(0, _total_tris - num_tris); + int extra_tris = std::max(0, _total_tris - num_tris); if (read_qtess && default_entry.get_num_surfaces() != 0) { - cerr << extra_tris << " triangles unaccounted for.\n"; + std::cerr << extra_tris << " triangles unaccounted for.\n"; } default_entry.set_num_tris(extra_tris); @@ -180,13 +180,13 @@ run() { int tris = 0; - ostream &out = get_output(); + std::ostream &out = get_output(); Surfaces::const_iterator si; for (si = _surfaces.begin(); si != _surfaces.end(); ++si) { tris += (*si)->write_qtess_parameter(out); } - cerr << tris << " tris generated.\n"; + std::cerr << tris << " tris generated.\n"; } else { @@ -197,7 +197,7 @@ run() { tris += (*si)->tesselate(); } - cerr << tris << " tris generated.\n"; + std::cerr << tris << " tris generated.\n"; // Clear out the surfaces list before removing the vertices, since each // surface is holding reference counts to the previously-used vertices. diff --git a/pandatool/src/egg-qtess/isoPlacer.cxx b/pandatool/src/egg-qtess/isoPlacer.cxx index 25c7a38b0a..fda96904e3 100644 --- a/pandatool/src/egg-qtess/isoPlacer.cxx +++ b/pandatool/src/egg-qtess/isoPlacer.cxx @@ -82,7 +82,7 @@ get_scores(int subdiv, int across, double ratio, // non-equal points. double d = v1.dot(v2); - _cscore[i] += acos(max(min(d, 1.0), -1.0)); + _cscore[i] += acos(std::max(std::min(d, 1.0), -1.0)); } } } diff --git a/pandatool/src/egg-qtess/qtessInputEntry.cxx b/pandatool/src/egg-qtess/qtessInputEntry.cxx index da7e940545..66df4c8813 100644 --- a/pandatool/src/egg-qtess/qtessInputEntry.cxx +++ b/pandatool/src/egg-qtess/qtessInputEntry.cxx @@ -21,6 +21,8 @@ #include #include +using std::string; + /** * */ @@ -354,7 +356,7 @@ count_tris(double tri_factor, int attempts) { * user control. */ void QtessInputEntry:: -output_extra(ostream &out, const pvector &iso, char axis) { +output_extra(std::ostream &out, const pvector &iso, char axis) { pvector::const_iterator di; int expect = 0; for (di = iso.begin(); di != iso.end(); ++di) { @@ -376,7 +378,7 @@ output_extra(ostream &out, const pvector &iso, char axis) { * */ void QtessInputEntry:: -output(ostream &out) const { +output(std::ostream &out) const { NodeNames::const_iterator nni; for (nni = _node_names.begin(); nni != _node_names.end(); @@ -458,6 +460,6 @@ output(ostream &out) const { * */ void QtessInputEntry:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << (*this) << "\n"; } diff --git a/pandatool/src/egg-qtess/qtessInputFile.cxx b/pandatool/src/egg-qtess/qtessInputFile.cxx index 850ad638f9..180a2e9547 100644 --- a/pandatool/src/egg-qtess/qtessInputFile.cxx +++ b/pandatool/src/egg-qtess/qtessInputFile.cxx @@ -15,6 +15,8 @@ #include "config_egg_qtess.h" #include "string_utils.h" +using std::string; + /** * */ @@ -306,7 +308,7 @@ count_tris() { * */ void QtessInputFile:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { Entries::const_iterator ei; for (ei = _entries.begin(); ei != _entries.end(); ++ei) { (*ei).write(out, indent_level); diff --git a/pandatool/src/egg-qtess/qtessSurface.cxx b/pandatool/src/egg-qtess/qtessSurface.cxx index 896fd68079..d7ccebe76f 100644 --- a/pandatool/src/egg-qtess/qtessSurface.cxx +++ b/pandatool/src/egg-qtess/qtessSurface.cxx @@ -23,6 +23,9 @@ #include "pset.h" #include "pmap.h" +using std::max; +using std::string; + /** * */ @@ -133,7 +136,7 @@ tesselate() { * should be tesselated uniformly. Returns the number of tris. */ int QtessSurface:: -write_qtess_parameter(ostream &out) { +write_qtess_parameter(std::ostream &out) { apply_match(); if (_tess_u == 0 || _tess_v == 0) { diff --git a/pandatool/src/eggbase/eggBase.cxx b/pandatool/src/eggbase/eggBase.cxx index 1ebd65a28e..83d07a0a6a 100644 --- a/pandatool/src/eggbase/eggBase.cxx +++ b/pandatool/src/eggbase/eggBase.cxx @@ -20,6 +20,8 @@ #include "dcast.h" #include "string_utils.h" +using std::string; + /** * */ diff --git a/pandatool/src/eggbase/eggConverter.cxx b/pandatool/src/eggbase/eggConverter.cxx index a55d68856f..036b7dea18 100644 --- a/pandatool/src/eggbase/eggConverter.cxx +++ b/pandatool/src/eggbase/eggConverter.cxx @@ -21,8 +21,8 @@ * with a leading dot. */ EggConverter:: -EggConverter(const string &format_name, - const string &preferred_extension, +EggConverter(const std::string &format_name, + const std::string &preferred_extension, bool allow_last_param, bool allow_stdout) : EggFilter(allow_last_param, allow_stdout), diff --git a/pandatool/src/eggbase/eggMultiFilter.cxx b/pandatool/src/eggbase/eggMultiFilter.cxx index 87900624f6..981c8ad4cf 100644 --- a/pandatool/src/eggbase/eggMultiFilter.cxx +++ b/pandatool/src/eggbase/eggMultiFilter.cxx @@ -81,7 +81,7 @@ handle_args(ProgramBase::Args &args) { nout << "Error opening file: " << _input_filename << "\n"; return false; } - string line; + std::string line; // File should be a space-delimited list of egg files while (std::getline(input, line, ' ')) { args.push_back(line); diff --git a/pandatool/src/eggbase/eggReader.cxx b/pandatool/src/eggbase/eggReader.cxx index 428e07710a..16c5e2ad28 100644 --- a/pandatool/src/eggbase/eggReader.cxx +++ b/pandatool/src/eggbase/eggReader.cxx @@ -178,7 +178,7 @@ handle_args(ProgramBase::Args &args) { exit(1); } } else { - if (!file_data.read(cin)) { + if (!file_data.read(std::cin)) { exit(1); } } diff --git a/pandatool/src/eggbase/eggToSomething.cxx b/pandatool/src/eggbase/eggToSomething.cxx index 3aa290ee32..eb6adc89e5 100644 --- a/pandatool/src/eggbase/eggToSomething.cxx +++ b/pandatool/src/eggbase/eggToSomething.cxx @@ -19,8 +19,8 @@ * just used in printing error messages and such. */ EggToSomething:: -EggToSomething(const string &format_name, - const string &preferred_extension, +EggToSomething(const std::string &format_name, + const std::string &preferred_extension, bool allow_last_param, bool allow_stdout) : EggConverter(format_name, preferred_extension, allow_last_param, allow_stdout) @@ -34,7 +34,7 @@ EggToSomething(const string &format_name, add_runline("[opts] input.egg >output" + _preferred_extension); } - string o_description; + std::string o_description; if (_allow_stdout) { if (_allow_last_param) { diff --git a/pandatool/src/eggbase/eggWriter.cxx b/pandatool/src/eggbase/eggWriter.cxx index 28365de2c1..c881991a08 100644 --- a/pandatool/src/eggbase/eggWriter.cxx +++ b/pandatool/src/eggbase/eggWriter.cxx @@ -47,7 +47,7 @@ EggWriter(bool allow_last_param, bool allow_stdout) : add_runline("[opts] >output.egg"); } - string o_description; + std::string o_description; if (_allow_stdout) { if (_allow_last_param) { diff --git a/pandatool/src/eggbase/somethingToEgg.cxx b/pandatool/src/eggbase/somethingToEgg.cxx index 6c8017d988..45d705f12c 100644 --- a/pandatool/src/eggbase/somethingToEgg.cxx +++ b/pandatool/src/eggbase/somethingToEgg.cxx @@ -22,8 +22,8 @@ * just used in printing error messages and such. */ SomethingToEgg:: -SomethingToEgg(const string &format_name, - const string &preferred_extension, +SomethingToEgg(const std::string &format_name, + const std::string &preferred_extension, bool allow_last_param, bool allow_stdout) : EggConverter(format_name, preferred_extension, allow_last_param, allow_stdout) { @@ -316,7 +316,7 @@ post_process_egg_file() { * specified parameter. var is a pointer to an AnimationConvert variable. */ bool SomethingToEgg:: -dispatch_animation_convert(const string &opt, const string &arg, void *var) { +dispatch_animation_convert(const std::string &opt, const std::string &arg, void *var) { AnimationConvert *ip = (AnimationConvert *)var; (*ip) = string_animation_convert(arg); if ((*ip) == AC_invalid) { diff --git a/pandatool/src/eggcharbase/eggBackPointer.cxx b/pandatool/src/eggcharbase/eggBackPointer.cxx index aa4a95f73a..400d9e3b2f 100644 --- a/pandatool/src/eggcharbase/eggBackPointer.cxx +++ b/pandatool/src/eggcharbase/eggBackPointer.cxx @@ -55,5 +55,5 @@ has_vertices() const { * Applies the indicated name change to the egg file. */ void EggBackPointer:: -set_name(const string &name) { +set_name(const std::string &name) { } diff --git a/pandatool/src/eggcharbase/eggCharacterCollection.cxx b/pandatool/src/eggcharbase/eggCharacterCollection.cxx index 3dfa5aaee8..f90c7d9a91 100644 --- a/pandatool/src/eggcharbase/eggCharacterCollection.cxx +++ b/pandatool/src/eggcharbase/eggCharacterCollection.cxx @@ -29,6 +29,8 @@ #include +using std::string; + /** * @@ -626,7 +628,7 @@ rename_char(int i, const string &name) { * */ void EggCharacterCollection:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { Characters::const_iterator ci; for (ci = _characters.begin(); ci != _characters.end(); ++ci) { @@ -646,7 +648,7 @@ write(ostream &out, int indent_level) const { * initially different. */ void EggCharacterCollection:: -check_errors(ostream &out, bool force_initial_rest_frame) { +check_errors(std::ostream &out, bool force_initial_rest_frame) { Characters::const_iterator ci; for (ci = _characters.begin(); ci != _characters.end(); ++ci) { EggCharacterData *char_data = (*ci); diff --git a/pandatool/src/eggcharbase/eggCharacterData.cxx b/pandatool/src/eggcharbase/eggCharacterData.cxx index 03cffa7d47..d3c7a54530 100644 --- a/pandatool/src/eggcharbase/eggCharacterData.cxx +++ b/pandatool/src/eggcharbase/eggCharacterData.cxx @@ -63,7 +63,7 @@ EggCharacterData:: * as if they are expected to have the same skeleton hierarchy. */ void EggCharacterData:: -rename_char(const string &name) { +rename_char(const std::string &name) { Models::iterator mi; for (mi = _models.begin(); mi != _models.end(); ++mi) { (*mi)._model_root->set_name(name); @@ -107,7 +107,7 @@ get_num_frames(int model_index) const { // We have a winner. Assume all other components will be similar. return num_frames; } - max_num_frames = max(max_num_frames, num_frames); + max_num_frames = std::max(max_num_frames, num_frames); } // Every component had either 1 frame or 0 frames. Return the maximum of @@ -154,7 +154,7 @@ check_num_frames(int model_index) { // than 0 or 1), we have a discrepency. This is an error condition. any_violations = true; } - max_num_frames = max(max_num_frames, num_frames); + max_num_frames = std::max(max_num_frames, num_frames); } if (any_violations) { @@ -338,7 +338,7 @@ choose_optimal_hierarchy() { * name. */ EggSliderData *EggCharacterData:: -find_slider(const string &name) const { +find_slider(const std::string &name) const { SlidersByName::const_iterator si; si = _sliders_by_name.find(name); if (si != _sliders_by_name.end()) { @@ -353,7 +353,7 @@ find_slider(const string &name) const { * already, creates a new one. */ EggSliderData *EggCharacterData:: -make_slider(const string &name) { +make_slider(const std::string &name) { SlidersByName::const_iterator si; si = _sliders_by_name.find(name); if (si != _sliders_by_name.end()) { @@ -397,7 +397,7 @@ estimate_db_size() const { * */ void EggCharacterData:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << "Character " << get_name() << ":\n"; get_root_joint()->write(out, indent_level + 2); diff --git a/pandatool/src/eggcharbase/eggComponentData.cxx b/pandatool/src/eggcharbase/eggComponentData.cxx index 6a30bc4969..5af9dd3d57 100644 --- a/pandatool/src/eggcharbase/eggComponentData.cxx +++ b/pandatool/src/eggcharbase/eggComponentData.cxx @@ -53,7 +53,7 @@ EggComponentData:: * matched_name(). */ void EggComponentData:: -add_name(const string &name, NameUniquifier &uniquifier) { +add_name(const std::string &name, NameUniquifier &uniquifier) { if (_names.insert(name).second) { // This is a new name for this component. if (!has_name()) { @@ -71,7 +71,7 @@ add_name(const string &name, NameUniquifier &uniquifier) { * with this particular joint, false otherwise. */ bool EggComponentData:: -matches_name(const string &name) const { +matches_name(const std::string &name) const { if (name == get_name()) { return true; } diff --git a/pandatool/src/eggcharbase/eggJointData.cxx b/pandatool/src/eggcharbase/eggJointData.cxx index 8197a1ec84..65ed9505a5 100644 --- a/pandatool/src/eggcharbase/eggJointData.cxx +++ b/pandatool/src/eggcharbase/eggJointData.cxx @@ -22,6 +22,8 @@ #include "fftCompressor.h" #include "zStream.h" +using std::string; + TypeHandle EggJointData::_type_handle; @@ -259,7 +261,7 @@ score_reparent_to(EggJointData *new_parent, EggCharacterDb &db) { #else // The FFTCompressor does minimal run-length encoding, but to really get an // accurate measure we should zlib-compress the resulting stream. - ostringstream sstr; + std::ostringstream sstr; OCompressStream zstr(&sstr, false); zstr.write((const char *)dg.get_data(), dg.get_length()); zstr.flush(); @@ -442,7 +444,7 @@ add_back_pointer(int model_index, EggObject *egg_object) { * */ void EggJointData:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << "Joint " << get_name() << " (models:"; diff --git a/pandatool/src/eggcharbase/eggJointNodePointer.cxx b/pandatool/src/eggcharbase/eggJointNodePointer.cxx index 4ab8a7227a..c9c891606b 100644 --- a/pandatool/src/eggcharbase/eggJointNodePointer.cxx +++ b/pandatool/src/eggcharbase/eggJointNodePointer.cxx @@ -192,7 +192,7 @@ has_vertices() const { * pointer to it. */ EggJointPointer *EggJointNodePointer:: -make_new_joint(const string &name) { +make_new_joint(const std::string &name) { EggGroup *new_joint = new EggGroup(name); new_joint->set_group_type(EggGroup::GT_joint); _joint->add_child(new_joint); @@ -203,6 +203,6 @@ make_new_joint(const string &name) { * Applies the indicated name change to the egg file. */ void EggJointNodePointer:: -set_name(const string &name) { +set_name(const std::string &name) { _joint->set_name(name); } diff --git a/pandatool/src/eggcharbase/eggJointPointer.cxx b/pandatool/src/eggcharbase/eggJointPointer.cxx index 350931d635..6a5ed44003 100644 --- a/pandatool/src/eggcharbase/eggJointPointer.cxx +++ b/pandatool/src/eggcharbase/eggJointPointer.cxx @@ -69,7 +69,7 @@ expose(EggGroup::DCSType) { * Zeroes out the named components of the transform in the animation frames. */ void EggJointPointer:: -zero_channels(const string &) { +zero_channels(const std::string &) { } /** @@ -77,7 +77,7 @@ zero_channels(const string &) { * quantum. */ void EggJointPointer:: -quantize_channels(const string &, double) { +quantize_channels(const std::string &, double) { } /** diff --git a/pandatool/src/eggcharbase/eggMatrixTablePointer.cxx b/pandatool/src/eggcharbase/eggMatrixTablePointer.cxx index 130975fc0b..21c9c63516 100644 --- a/pandatool/src/eggcharbase/eggMatrixTablePointer.cxx +++ b/pandatool/src/eggcharbase/eggMatrixTablePointer.cxx @@ -17,6 +17,8 @@ #include "eggXfmAnimData.h" #include "eggXfmSAnim.h" +using std::string; + TypeHandle EggMatrixTablePointer::_type_handle; /** diff --git a/pandatool/src/eggcharbase/eggScalarTablePointer.cxx b/pandatool/src/eggcharbase/eggScalarTablePointer.cxx index 18f4aaaf5c..450bb548ce 100644 --- a/pandatool/src/eggcharbase/eggScalarTablePointer.cxx +++ b/pandatool/src/eggcharbase/eggScalarTablePointer.cxx @@ -89,7 +89,7 @@ get_frame(int n) const { * Applies the indicated name change to the egg file. */ void EggScalarTablePointer:: -set_name(const string &name) { +set_name(const std::string &name) { // Actually, let's not rename the slider table (yet), because we haven't // written the code to rename all of the morph targets. diff --git a/pandatool/src/eggcharbase/eggSliderData.cxx b/pandatool/src/eggcharbase/eggSliderData.cxx index 25bbae1140..91d041366f 100644 --- a/pandatool/src/eggcharbase/eggSliderData.cxx +++ b/pandatool/src/eggcharbase/eggSliderData.cxx @@ -88,7 +88,7 @@ add_back_pointer(int model_index, EggObject *egg_object) { * */ void EggSliderData:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << "Slider " << get_name() << " (models:"; diff --git a/pandatool/src/eggprogs/eggListTextures.cxx b/pandatool/src/eggprogs/eggListTextures.cxx index c804a8110b..fd44c73a48 100644 --- a/pandatool/src/eggprogs/eggListTextures.cxx +++ b/pandatool/src/eggprogs/eggListTextures.cxx @@ -48,10 +48,10 @@ run() { Filename fullpath = (*ti)->get_fullpath(); PNMImageHeader header; if (header.read_header(fullpath)) { - cout << fullpath.get_basename() << " : " + std::cout << fullpath.get_basename() << " : " << header.get_x_size() << " " << header.get_y_size() << "\n"; } else { - cout << fullpath.get_basename() << " : unknown\n"; + std::cout << fullpath.get_basename() << " : unknown\n"; } } } diff --git a/pandatool/src/eggprogs/eggRetargetAnim.cxx b/pandatool/src/eggprogs/eggRetargetAnim.cxx index 0c522652e1..ba55d19b7f 100644 --- a/pandatool/src/eggprogs/eggRetargetAnim.cxx +++ b/pandatool/src/eggprogs/eggRetargetAnim.cxx @@ -97,7 +97,7 @@ run() { exit(1); } - string ref_name = col.get_character(0)->get_name(); + std::string ref_name = col.get_character(0)->get_name(); // Now rename all of the animations to the same name as the reference model, // and add the reference animation in to the same collection to match it up @@ -111,7 +111,7 @@ run() { EggCharacterData *char_data = _collection->get_character(0); nout << "Processing " << char_data->get_name() << "\n"; - typedef pset Names; + typedef pset Names; Names keep_names; vector_string::const_iterator si; @@ -133,7 +133,7 @@ run() { */ void EggRetargetAnim:: retarget_anim(EggCharacterData *char_data, EggJointData *joint_data, - int reference_model, const pset &keep_names, + int reference_model, const pset &keep_names, EggCharacterDb &db) { if (keep_names.find(joint_data->get_name()) != keep_names.end()) { // Don't retarget this joint; keep the translation and scale and whatever. diff --git a/pandatool/src/eggprogs/eggTextureCards.cxx b/pandatool/src/eggprogs/eggTextureCards.cxx index bf7032230f..bb3350f02c 100644 --- a/pandatool/src/eggprogs/eggTextureCards.cxx +++ b/pandatool/src/eggprogs/eggTextureCards.cxx @@ -22,6 +22,8 @@ #include +using std::string; + /** * */ diff --git a/pandatool/src/eggprogs/eggToC.cxx b/pandatool/src/eggprogs/eggToC.cxx index a1f0a4d081..bafc37fde9 100644 --- a/pandatool/src/eggprogs/eggToC.cxx +++ b/pandatool/src/eggprogs/eggToC.cxx @@ -22,6 +22,9 @@ #include "eggBin.h" #include "string_utils.h" +using std::ostream; +using std::string; + /** * */ diff --git a/pandatool/src/eggprogs/eggTopstrip.cxx b/pandatool/src/eggprogs/eggTopstrip.cxx index 4b0397e065..2a46431f25 100644 --- a/pandatool/src/eggprogs/eggTopstrip.cxx +++ b/pandatool/src/eggprogs/eggTopstrip.cxx @@ -185,14 +185,14 @@ run() { */ void EggTopstrip:: check_transform_channels() { - static string expected = "ijkphrxyz"; + static std::string expected = "ijkphrxyz"; static const int num_channels = 9; bool has_each[num_channels]; memset(has_each, 0, num_channels * sizeof(bool)); for (size_t p = 0; p < _transform_channels.size(); p++) { int i = expected.find(_transform_channels[p]); - if (i == (int)string::npos) { + if (i == (int)std::string::npos) { nout << "Invalid letter for -s: " << _transform_channels[p] << "\n"; exit(1); } @@ -235,7 +235,7 @@ strip_anim(EggCharacterData *char_data, EggJointData *joint_data, int num_into_frames = char_data->get_num_frames(i); int num_from_frames = from_char->get_num_frames(model); - int num_frames = max(num_into_frames, num_from_frames); + int num_frames = std::max(num_into_frames, num_from_frames); EggBackPointer *back = joint_data->get_model(i); nassertv(back != nullptr); diff --git a/pandatool/src/flt/fltBeadID.cxx b/pandatool/src/flt/fltBeadID.cxx index 32348d583e..4b6dc695a7 100644 --- a/pandatool/src/flt/fltBeadID.cxx +++ b/pandatool/src/flt/fltBeadID.cxx @@ -28,7 +28,7 @@ FltBeadID(FltHeader *header) : FltBead(header) { * Returns the id (name) of this particular bead. Each MultiGen bead will * have a unique name. */ -const string &FltBeadID:: +const std::string &FltBeadID:: get_id() const { return _id; } @@ -38,7 +38,7 @@ get_id() const { * is unique to this bead. */ void FltBeadID:: -set_id(const string &id) { +set_id(const std::string &id) { _id = id; } @@ -48,7 +48,7 @@ set_id(const string &id) { * flt file, use FltHeader::write_flt(). */ void FltBeadID:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type(); if (!_id.empty()) { out << " " << _id; diff --git a/pandatool/src/flt/fltError.cxx b/pandatool/src/flt/fltError.cxx index fe9cf918bb..b0b58ea6ae 100644 --- a/pandatool/src/flt/fltError.cxx +++ b/pandatool/src/flt/fltError.cxx @@ -13,8 +13,8 @@ #include "fltError.h" -ostream & -operator << (ostream &out, FltError error) { +std::ostream & +operator << (std::ostream &out, FltError error) { switch (error) { case FE_ok: return out << "no error"; diff --git a/pandatool/src/flt/fltExternalReference.cxx b/pandatool/src/flt/fltExternalReference.cxx index 1780e577ba..fa6aaa05f4 100644 --- a/pandatool/src/flt/fltExternalReference.cxx +++ b/pandatool/src/flt/fltExternalReference.cxx @@ -45,7 +45,7 @@ apply_converted_filenames() { * flt file, use FltHeader::write_flt(). */ void FltExternalReference:: -output(ostream &out) const { +output(std::ostream &out) const { out << "External " << get_ref_filename(); if (!_bead_id.empty()) { out << " (" << _bead_id << ")"; @@ -83,7 +83,7 @@ extract_record(FltRecordReader &reader) { nassertr(reader.get_opcode() == FO_external_ref, false); DatagramIterator &iterator = reader.get_iterator(); - string name = iterator.get_fixed_string(200); + std::string name = iterator.get_fixed_string(200); iterator.skip_bytes(1 + 1); iterator.skip_bytes(2); // Undocumented additional padding. _flags = iterator.get_be_uint32(); @@ -95,7 +95,7 @@ extract_record(FltRecordReader &reader) { if (!name.empty() && name[name.length() - 1] == '>') { // Extract out the bead name. size_t open = name.rfind('<'); - if (open != string::npos) { + if (open != std::string::npos) { _orig_filename = name.substr(0, open); _bead_id = name.substr(open + 1, name.length() - open - 2); } @@ -120,7 +120,7 @@ build_record(FltRecordWriter &writer) const { writer.set_opcode(FO_external_ref); Datagram &datagram = writer.update_datagram(); - string name = _orig_filename; + std::string name = _orig_filename; if (!_bead_id.empty()) { name += "<" + _bead_id + ">"; } diff --git a/pandatool/src/flt/fltHeader.cxx b/pandatool/src/flt/fltHeader.cxx index e6cd4dbd10..a08748637e 100644 --- a/pandatool/src/flt/fltHeader.cxx +++ b/pandatool/src/flt/fltHeader.cxx @@ -190,7 +190,7 @@ read_flt(Filename filename) { _flt_filename = filename; 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) { assert(!flt_error_abort); return FE_could_not_open; @@ -205,7 +205,7 @@ read_flt(Filename filename) { * Returns FE_ok on success, otherwise on failure. */ FltError FltHeader:: -read_flt(istream &in) { +read_flt(std::istream &in) { FltRecordReader reader(in); FltError result = reader.advance(); if (result == FE_end_of_file) { @@ -260,7 +260,7 @@ write_flt(Filename filename) { * Returns FE_ok on success, otherwise on failure. */ FltError FltHeader:: -write_flt(ostream &out) { +write_flt(std::ostream &out) { FltRecordWriter writer(out); FltError result = write_record_and_children(writer); @@ -600,14 +600,14 @@ has_color_name(int color_index) const { /** * Returns the name associated with the given color, if any. */ -string FltHeader:: +std::string FltHeader:: get_color_name(int color_index) const { ColorNames::const_iterator ni; ni = _color_names.find(color_index); if (ni != _color_names.end()) { return (*ni).second; } - return string(); + return std::string(); } /** @@ -836,7 +836,7 @@ add_material(FltMaterial *material) { } else { // Make sure our next generated material index will be different from any // existing material indices. - _next_material_index = max(_next_material_index, material->_material_index + 1); + _next_material_index = std::max(_next_material_index, material->_material_index + 1); } _materials[material->_material_index] = material; @@ -895,7 +895,7 @@ add_texture(FltTexture *texture) { } else { // Make sure our next generated pattern index will be different from any // existing texture indices. - _next_pattern_index = max(_next_pattern_index, texture->_pattern_index + 1); + _next_pattern_index = std::max(_next_pattern_index, texture->_pattern_index + 1); } _textures[texture->_pattern_index] = texture; @@ -1563,7 +1563,7 @@ write_color_palette(FltRecordWriter &writer) const { // Now append all the names at the end. ColorNames::const_iterator ni; for (ni = _color_names.begin(); ni != _color_names.end(); ++ni) { - string name = (*ni).second.substr(0, 80); + std::string name = (*ni).second.substr(0, 80); int entry_length = name.length() + 8; datagram.add_be_uint16(entry_length); datagram.pad_bytes(2); diff --git a/pandatool/src/flt/fltInstanceRef.cxx b/pandatool/src/flt/fltInstanceRef.cxx index 8622f6180b..f33ef3b145 100644 --- a/pandatool/src/flt/fltInstanceRef.cxx +++ b/pandatool/src/flt/fltInstanceRef.cxx @@ -42,7 +42,7 @@ get_instance() const { * flt file, use FltHeader::write_flt(). */ void FltInstanceRef:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << "instance"; FltInstanceDefinition *def = _header->get_instance(_instance_index); if (def != nullptr) { diff --git a/pandatool/src/flt/fltMeshPrimitive.cxx b/pandatool/src/flt/fltMeshPrimitive.cxx index 0456cad142..6db78c8059 100644 --- a/pandatool/src/flt/fltMeshPrimitive.cxx +++ b/pandatool/src/flt/fltMeshPrimitive.cxx @@ -91,7 +91,7 @@ build_record(FltRecordWriter &writer) const { int max_index = 0; Vertices::const_iterator vi; for (vi = _vertices.begin(); vi != _vertices.end(); ++vi) { - max_index = max(max_index, (*vi)); + max_index = std::max(max_index, (*vi)); } int vertex_width; diff --git a/pandatool/src/flt/fltOpcode.cxx b/pandatool/src/flt/fltOpcode.cxx index 4ca497a9ee..92fd64afda 100644 --- a/pandatool/src/flt/fltOpcode.cxx +++ b/pandatool/src/flt/fltOpcode.cxx @@ -13,8 +13,8 @@ #include "fltOpcode.h" -ostream & -operator << (ostream &out, FltOpcode opcode) { +std::ostream & +operator << (std::ostream &out, FltOpcode opcode) { switch (opcode) { case FO_none: return out << "null opcode"; diff --git a/pandatool/src/flt/fltPackedColor.cxx b/pandatool/src/flt/fltPackedColor.cxx index cc5dc7540d..0faa4eb644 100644 --- a/pandatool/src/flt/fltPackedColor.cxx +++ b/pandatool/src/flt/fltPackedColor.cxx @@ -19,7 +19,7 @@ * */ void FltPackedColor:: -output(ostream &out) const { +output(std::ostream &out) const { out << "(" << _r << " " << _g << " " << _b << " " << _a << ")"; } diff --git a/pandatool/src/flt/fltRecord.cxx b/pandatool/src/flt/fltRecord.cxx index 5325259ec6..9fcc52fcfa 100644 --- a/pandatool/src/flt/fltRecord.cxx +++ b/pandatool/src/flt/fltRecord.cxx @@ -220,7 +220,7 @@ has_comment() const { * Retrieves the comment for this record, or empty string if the record has no * comment. */ -const string &FltRecord:: +const std::string &FltRecord:: get_comment() const { return _comment; } @@ -237,7 +237,7 @@ clear_comment() { * Changes the comment for this record. */ void FltRecord:: -set_comment(const string &comment) { +set_comment(const std::string &comment) { _comment = comment; } @@ -251,7 +251,7 @@ set_comment(const string &comment) { * this is exactly the sort of thing we expect. */ void FltRecord:: -check_remaining_size(const DatagramIterator &di, const string &name) const { +check_remaining_size(const DatagramIterator &di, const std::string &name) const { if (di.get_remaining_size() == 0) { return; } @@ -291,7 +291,7 @@ apply_converted_filenames() { * flt file, use FltHeader::write_flt(). */ void FltRecord:: -output(ostream &out) const { +output(std::ostream &out) const { out << get_type(); } @@ -301,7 +301,7 @@ output(ostream &out) const { * flt file, use FltHeader::write_flt(). */ void FltRecord:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << *this; write_children(out, indent_level); } @@ -311,7 +311,7 @@ write(ostream &out, int indent_level) const { * line of the record description, writes out the list of children. */ void FltRecord:: -write_children(ostream &out, int indent_level) const { +write_children(std::ostream &out, int indent_level) const { if (!_ancillary.empty()) { out << " + " << _ancillary.size() << " ancillary"; } diff --git a/pandatool/src/flt/fltRecordReader.cxx b/pandatool/src/flt/fltRecordReader.cxx index f2650fa423..c999001d64 100644 --- a/pandatool/src/flt/fltRecordReader.cxx +++ b/pandatool/src/flt/fltRecordReader.cxx @@ -22,7 +22,7 @@ * */ FltRecordReader:: -FltRecordReader(istream &in) : +FltRecordReader(std::istream &in) : _in(in) { _opcode = FO_none; diff --git a/pandatool/src/flt/fltRecordWriter.cxx b/pandatool/src/flt/fltRecordWriter.cxx index df3d904d27..909e5ce298 100644 --- a/pandatool/src/flt/fltRecordWriter.cxx +++ b/pandatool/src/flt/fltRecordWriter.cxx @@ -28,7 +28,7 @@ static const int max_write_length = 65532; * */ FltRecordWriter:: -FltRecordWriter(ostream &out) : +FltRecordWriter(std::ostream &out) : _out(out) { } @@ -75,7 +75,7 @@ FltError FltRecordWriter:: advance() { int start_byte = 0; int write_length = - min((int)_datagram.get_length() - start_byte, max_write_length - header_size); + std::min((int)_datagram.get_length() - start_byte, max_write_length - header_size); FltOpcode opcode = _opcode; do { @@ -107,7 +107,7 @@ advance() { start_byte += write_length; write_length = - min((int)_datagram.get_length() - start_byte, max_write_length - header_size); + std::min((int)_datagram.get_length() - start_byte, max_write_length - header_size); opcode = FO_continuation; } while (write_length > 0); diff --git a/pandatool/src/flt/fltTexture.cxx b/pandatool/src/flt/fltTexture.cxx index ee56205c6f..c65f5a05e2 100644 --- a/pandatool/src/flt/fltTexture.cxx +++ b/pandatool/src/flt/fltTexture.cxx @@ -123,7 +123,7 @@ set_texture_filename(const Filename &filename) { */ Filename FltTexture:: get_attr_filename() const { - string texture_filename = get_texture_filename(); + std::string texture_filename = get_texture_filename(); return Filename::binary_filename(texture_filename + ".attr"); } @@ -142,15 +142,15 @@ read_attr_data() { } // Determine the file's size so we can read it all into one big datagram. - attr.seekg(0, ios::end); + attr.seekg(0, std::ios::end); if (attr.fail()) { return FE_read_error; } - streampos length = attr.tellg(); + std::streampos length = attr.tellg(); char *buffer = new char[length]; - attr.seekg(0, ios::beg); + attr.seekg(0, std::ios::beg); attr.read(buffer, length); if (attr.fail()) { return FE_read_error; diff --git a/pandatool/src/flt/fltUnsupportedRecord.cxx b/pandatool/src/flt/fltUnsupportedRecord.cxx index e3bcc07a2a..7a6e67aa84 100644 --- a/pandatool/src/flt/fltUnsupportedRecord.cxx +++ b/pandatool/src/flt/fltUnsupportedRecord.cxx @@ -31,7 +31,7 @@ FltUnsupportedRecord(FltHeader *header) : FltRecord(header) { * flt file, use FltHeader::write_flt(). */ void FltUnsupportedRecord:: -output(ostream &out) const { +output(std::ostream &out) const { out << "Unsupported(" << _opcode << ")"; } diff --git a/pandatool/src/flt/fltVertexList.cxx b/pandatool/src/flt/fltVertexList.cxx index 941d35c300..65da9b5923 100644 --- a/pandatool/src/flt/fltVertexList.cxx +++ b/pandatool/src/flt/fltVertexList.cxx @@ -65,7 +65,7 @@ add_vertex(FltVertex *vertex) { * flt file, use FltHeader::write_flt(). */ void FltVertexList:: -output(ostream &out) const { +output(std::ostream &out) const { out << _vertices.size() << " vertices"; } diff --git a/pandatool/src/fltegg/fltToEggConverter.cxx b/pandatool/src/fltegg/fltToEggConverter.cxx index bd4898b0c5..98b01938c5 100644 --- a/pandatool/src/fltegg/fltToEggConverter.cxx +++ b/pandatool/src/fltegg/fltToEggConverter.cxx @@ -35,6 +35,8 @@ #include "eggExternalReference.h" #include "string_utils.h" +using std::string; + /** * diff --git a/pandatool/src/fltegg/fltToEggLevelState.cxx b/pandatool/src/fltegg/fltToEggLevelState.cxx index 238208527e..ef396fd818 100644 --- a/pandatool/src/fltegg/fltToEggLevelState.cxx +++ b/pandatool/src/fltegg/fltToEggLevelState.cxx @@ -56,7 +56,7 @@ ParentNodes() { * group per polygon. */ EggGroupNode *FltToEggLevelState:: -get_synthetic_group(const string &name, +get_synthetic_group(const std::string &name, const FltBead *transform_bead, FltGeometry::BillboardType type) { LMatrix4d transform = transform_bead->get_transform(); diff --git a/pandatool/src/fltprogs/eggToFlt.cxx b/pandatool/src/fltprogs/eggToFlt.cxx index 5ca9224225..f6cbc9d24f 100644 --- a/pandatool/src/fltprogs/eggToFlt.cxx +++ b/pandatool/src/fltprogs/eggToFlt.cxx @@ -93,7 +93,7 @@ run() { * Dispatch function for the -attr parameter. */ bool EggToFlt:: -dispatch_attr(const string &opt, const string &arg, void *var) { +dispatch_attr(const std::string &opt, const std::string &arg, void *var) { FltHeader::AttrUpdate *ip = (FltHeader::AttrUpdate *)var; if (cmp_nocase(arg, "none") == 0) { @@ -231,7 +231,7 @@ convert_primitive(EggPrimitive *egg_primitive, FltBead *flt_node, void EggToFlt:: convert_group(EggGroup *egg_group, FltBead *flt_node, FltGeometry::BillboardType billboard) { - ostringstream egg_syntax; + std::ostringstream egg_syntax; FltGroup *flt_group = new FltGroup(_flt_header); flt_node->add_child(flt_group); @@ -450,9 +450,9 @@ apply_transform(EggTransform *egg_transform, FltBead *flt_node) { * comment, so that flt2egg will reapply it to the egg groups. */ void EggToFlt:: -apply_egg_syntax(const string &egg_syntax, FltRecord *flt_record) { +apply_egg_syntax(const std::string &egg_syntax, FltRecord *flt_record) { if (!egg_syntax.empty()) { - ostringstream out; + std::ostringstream out; out << " {\n" << egg_syntax << "}"; diff --git a/pandatool/src/fltprogs/fltInfo.cxx b/pandatool/src/fltprogs/fltInfo.cxx index a6d4649bff..bd0e9d8a83 100644 --- a/pandatool/src/fltprogs/fltInfo.cxx +++ b/pandatool/src/fltprogs/fltInfo.cxx @@ -65,7 +65,7 @@ run() { void FltInfo:: list_hierarchy(FltRecord *record, int indent_level) { // Maybe in the future we can do something fancier here. - record->write(cout, indent_level); + record->write(std::cout, indent_level); } diff --git a/pandatool/src/gtk-stats/gtkStats.cxx b/pandatool/src/gtk-stats/gtkStats.cxx index fad28f1a4b..e6889ff23b 100644 --- a/pandatool/src/gtk-stats/gtkStats.cxx +++ b/pandatool/src/gtk-stats/gtkStats.cxx @@ -66,9 +66,9 @@ main(int argc, char *argv[]) { g_signal_connect(G_OBJECT(main_window), "destroy", G_CALLBACK(destroy), nullptr); - ostringstream stream; + std::ostringstream stream; stream << "Listening on port " << pstats_port; - string str = stream.str(); + std::string str = stream.str(); GtkWidget *label = gtk_label_new(str.c_str()); gtk_container_add(GTK_CONTAINER(main_window), label); gtk_widget_show(label); @@ -76,12 +76,12 @@ main(int argc, char *argv[]) { // Create the server object. server = new GtkStatsServer; if (!server->listen()) { - ostringstream stream; + std::ostringstream stream; stream << "Unable to open port " << pstats_port << ". Try specifying a different\n" << "port number using pstats-port in your Config file."; - string str = stream.str(); + std::string str = stream.str(); GtkWidget *dialog = gtk_message_dialog_new(GTK_WINDOW(main_window), diff --git a/pandatool/src/gtk-stats/gtkStatsChartMenu.cxx b/pandatool/src/gtk-stats/gtkStatsChartMenu.cxx index 5bd5a7691f..c7f8b3f4be 100644 --- a/pandatool/src/gtk-stats/gtkStatsChartMenu.cxx +++ b/pandatool/src/gtk-stats/gtkStatsChartMenu.cxx @@ -48,7 +48,7 @@ get_menu_widget() { void GtkStatsChartMenu:: add_to_menu_bar(GtkWidget *menu_bar, int position) { const PStatClientData *client_data = _monitor->get_client_data(); - string thread_name; + std::string thread_name; if (_thread_index == 0) { // A special case for the main thread. thread_name = "Graphs"; @@ -142,7 +142,7 @@ add_view(GtkWidget *parent_menu, const PStatViewLevel *view_level, int collector = view_level->get_collector(); const PStatClientData *client_data = _monitor->get_client_data(); - string collector_name = client_data->get_collector_name(collector); + std::string collector_name = client_data->get_collector_name(collector); GtkStatsMonitor::MenuDef smd(_thread_index, collector, show_level); const GtkStatsMonitor::MenuDef *menu_def = _monitor->add_menu(smd); @@ -158,7 +158,7 @@ add_view(GtkWidget *parent_menu, const PStatViewLevel *view_level, if (num_children > 1) { // If the collector has more than one child, add a menu entry to go // directly to each of its children. - string submenu_name = collector_name + " components"; + std::string submenu_name = collector_name + " components"; GtkWidget *submenu_item = gtk_menu_item_new_with_label(submenu_name.c_str()); gtk_widget_show(submenu_item); diff --git a/pandatool/src/gtk-stats/gtkStatsGraph.cxx b/pandatool/src/gtk-stats/gtkStatsGraph.cxx index 2f1b1e7189..e56e262d23 100644 --- a/pandatool/src/gtk-stats/gtkStatsGraph.cxx +++ b/pandatool/src/gtk-stats/gtkStatsGraph.cxx @@ -341,8 +341,8 @@ void GtkStatsGraph:: setup_pixmap(int xsize, int ysize) { release_pixmap(); - _pixmap_xsize = max(xsize, 0); - _pixmap_ysize = max(ysize, 0); + _pixmap_xsize = std::max(xsize, 0); + _pixmap_ysize = std::max(ysize, 0); _pixmap = gdk_pixmap_new(_graph_window->window, _pixmap_xsize, _pixmap_ysize, -1); // g_object_ref(_pixmap); Should this be ref_sink? diff --git a/pandatool/src/gtk-stats/gtkStatsMonitor.cxx b/pandatool/src/gtk-stats/gtkStatsMonitor.cxx index 1c7a8b1f1f..4f78d88450 100644 --- a/pandatool/src/gtk-stats/gtkStatsMonitor.cxx +++ b/pandatool/src/gtk-stats/gtkStatsMonitor.cxx @@ -67,7 +67,7 @@ GtkStatsMonitor:: * Should be redefined to return a descriptive name for the type of * PStatsMonitor this is. */ -string GtkStatsMonitor:: +std::string GtkStatsMonitor:: get_monitor_name() { return "GtkStats"; } @@ -103,7 +103,7 @@ got_hello() { void GtkStatsMonitor:: got_bad_version(int client_major, int client_minor, int server_major, int server_minor) { - ostringstream str; + std::ostringstream str; str << "Unable to honor connection attempt from " << get_client_progname() << " on " << get_client_hostname() << ": unsupported PStats version " @@ -117,7 +117,7 @@ got_bad_version(int client_major, int client_minor, << ".0 through " << server_major << "." << server_minor << ")."; } - string message = str.str(); + std::string message = str.str(); GtkWidget *dialog = gtk_message_dialog_new(GTK_WINDOW(main_window), GTK_DIALOG_DESTROY_WITH_PARENT, @@ -279,7 +279,7 @@ open_piano_roll(int thread_index) { */ const GtkStatsMonitor::MenuDef *GtkStatsMonitor:: add_menu(const MenuDef &menu_def) { - pair result = _menus.insert(menu_def); + std::pair result = _menus.insert(menu_def); Menus::iterator mi = result.first; const GtkStatsMonitor::MenuDef &new_menu_def = (*mi); if (result.second) { diff --git a/pandatool/src/gtk-stats/gtkStatsPianoRoll.cxx b/pandatool/src/gtk-stats/gtkStatsPianoRoll.cxx index f29ae4955c..60a3dc7887 100644 --- a/pandatool/src/gtk-stats/gtkStatsPianoRoll.cxx +++ b/pandatool/src/gtk-stats/gtkStatsPianoRoll.cxx @@ -47,8 +47,8 @@ GtkStatsPianoRoll(GtkStatsMonitor *monitor, int thread_index) : const PStatClientData *client_data = GtkStatsGraph::_monitor->get_client_data(); - string thread_name = client_data->get_thread_name(_thread_index); - string window_title = thread_name + " thread piano roll"; + std::string thread_name = client_data->get_thread_name(_thread_index); + std::string window_title = thread_name + " thread piano roll"; gtk_window_set_title(GTK_WINDOW(_window), window_title.c_str()); gtk_widget_show_all(_window); @@ -441,7 +441,7 @@ draw_guide_label(const PStatGraph::GuideBar &bar) { } int x = height_to_pixel(bar._height); - const string &label = bar._label; + const std::string &label = bar._label; PangoLayout *layout = gtk_widget_create_pango_layout(_window, label.c_str()); int width, height; diff --git a/pandatool/src/gtk-stats/gtkStatsStripChart.cxx b/pandatool/src/gtk-stats/gtkStatsStripChart.cxx index 8370cd958b..117ef96576 100644 --- a/pandatool/src/gtk-stats/gtkStatsStripChart.cxx +++ b/pandatool/src/gtk-stats/gtkStatsStripChart.cxx @@ -111,7 +111,7 @@ new_collector(int collector_index) { void GtkStatsStripChart:: new_data(int thread_index, int frame_number) { if (is_title_unknown()) { - string window_title = get_title_text(); + std::string window_title = get_title_text(); if (!is_title_unknown()) { gtk_window_set_title(GTK_WINDOW(_window), window_title.c_str()); } @@ -120,7 +120,7 @@ new_data(int thread_index, int frame_number) { if (!_pause) { update(); - string text = format_number(get_average_net_value(), get_guide_bar_units(), get_guide_bar_unit_name()); + std::string text = format_number(get_average_net_value(), get_guide_bar_units(), get_guide_bar_unit_name()); if (_net_value_text != text) { _net_value_text = text; gtk_label_set_text(GTK_LABEL(_total_label), _net_value_text.c_str()); @@ -575,7 +575,7 @@ draw_guide_label(const PStatGraph::GuideBar &bar, int last_y) { } int y = height_to_pixel(bar._height); - const string &label = bar._label; + const std::string &label = bar._label; PangoLayout *layout = gtk_widget_create_pango_layout(_window, label.c_str()); int width, height; diff --git a/pandatool/src/imagebase/imageWriter.cxx b/pandatool/src/imagebase/imageWriter.cxx index 3a4bfc1d56..eb50188e29 100644 --- a/pandatool/src/imagebase/imageWriter.cxx +++ b/pandatool/src/imagebase/imageWriter.cxx @@ -26,7 +26,7 @@ ImageWriter(bool allow_last_param) : } add_runline("[opts] -o outputimage"); - string o_description; + std::string o_description; if (_allow_last_param) { o_description = "Specify the filename to which the resulting image file will be written. " diff --git a/pandatool/src/imageprogs/imageResize.cxx b/pandatool/src/imageprogs/imageResize.cxx index f3c51c8554..a41ff771de 100644 --- a/pandatool/src/imageprogs/imageResize.cxx +++ b/pandatool/src/imageprogs/imageResize.cxx @@ -87,11 +87,11 @@ run() { * Interprets the -x or -y parameters. */ bool ImageResize:: -dispatch_size_request(const string &opt, const string &arg, void *var) { +dispatch_size_request(const std::string &opt, const std::string &arg, void *var) { SizeRequest *ip = (SizeRequest *)var; if (!arg.empty() && arg[arg.length() - 1] == '%') { // A ratio. - string str = arg.substr(0, arg.length() - 1); + std::string str = arg.substr(0, arg.length() - 1); double ratio; if (!string_to_double(str, ratio)) { nout << "Invalid ratio for -" << opt << ": " diff --git a/pandatool/src/imageprogs/imageTrans.cxx b/pandatool/src/imageprogs/imageTrans.cxx index 48bc98c5d2..517abee647 100644 --- a/pandatool/src/imageprogs/imageTrans.cxx +++ b/pandatool/src/imageprogs/imageTrans.cxx @@ -144,7 +144,7 @@ run() { * Interprets the -chan parameter. */ bool ImageTrans:: -dispatch_channels(const string &opt, const string &arg, void *var) { +dispatch_channels(const std::string &opt, const std::string &arg, void *var) { Channels *ip = (Channels *)var; if (cmp_nocase(arg, "l") == 0) { (*ip) = C_l; diff --git a/pandatool/src/imageprogs/imageTransformColors.cxx b/pandatool/src/imageprogs/imageTransformColors.cxx index 0600956a91..0efee4aab0 100644 --- a/pandatool/src/imageprogs/imageTransformColors.cxx +++ b/pandatool/src/imageprogs/imageTransformColors.cxx @@ -16,6 +16,10 @@ #include "pnmImage.h" #include +using std::max; +using std::min; +using std::string; + /** * */ diff --git a/pandatool/src/lwo/iffChunk.cxx b/pandatool/src/lwo/iffChunk.cxx index e3ba7107a5..a86ac62dd9 100644 --- a/pandatool/src/lwo/iffChunk.cxx +++ b/pandatool/src/lwo/iffChunk.cxx @@ -22,7 +22,7 @@ TypeHandle IffChunk::_type_handle; * */ void IffChunk:: -output(ostream &out) const { +output(std::ostream &out) const { out << _id << " (" << get_type() << ")"; } @@ -30,7 +30,7 @@ output(ostream &out) const { * */ void IffChunk:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << _id << " { ... }\n"; } diff --git a/pandatool/src/lwo/iffGenericChunk.cxx b/pandatool/src/lwo/iffGenericChunk.cxx index 87625c2193..c8eaf015ee 100644 --- a/pandatool/src/lwo/iffGenericChunk.cxx +++ b/pandatool/src/lwo/iffGenericChunk.cxx @@ -37,7 +37,7 @@ read_iff(IffInputFile *in, size_t stop_at) { * */ void IffGenericChunk:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << get_id() << " { " << _data.get_length() << " bytes }\n"; } diff --git a/pandatool/src/lwo/iffId.cxx b/pandatool/src/lwo/iffId.cxx index 6d31a79bad..eda63c0b5d 100644 --- a/pandatool/src/lwo/iffId.cxx +++ b/pandatool/src/lwo/iffId.cxx @@ -19,7 +19,7 @@ * */ void IffId:: -output(ostream &out) const { +output(std::ostream &out) const { // If all of the characters are printable, just output them. if (isprint(_id._c[0]) && isprint(_id._c[1]) && isprint(_id._c[2]) && isprint(_id._c[3])) { @@ -32,10 +32,10 @@ output(ostream &out) const { } else { // Otherwise, write out the hex. - out << "0x" << hex << setfill('0'); + out << "0x" << std::hex << std::setfill('0'); for (int i = 0; i < 4; i++) { - out << setw(2) << (int)(unsigned char)_id._c[i]; + out << std::setw(2) << (int)(unsigned char)_id._c[i]; } - out << dec << setfill(' '); + out << std::dec << std::setfill(' '); } } diff --git a/pandatool/src/lwo/iffInputFile.cxx b/pandatool/src/lwo/iffInputFile.cxx index e3ffa34044..f00dbf5469 100644 --- a/pandatool/src/lwo/iffInputFile.cxx +++ b/pandatool/src/lwo/iffInputFile.cxx @@ -51,7 +51,7 @@ open_read(Filename filename) { filename.set_binary(); 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) { return false; } @@ -68,7 +68,7 @@ open_read(Filename filename) { * IffInputFile destructs. */ void IffInputFile:: -set_input(istream *input, bool owns_istream) { +set_input(std::istream *input, bool owns_istream) { if (_owns_istream) { VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr(); vfs->close_read_file(_input); @@ -174,9 +174,9 @@ get_be_float32() { /** * Extracts a null-terminated string. */ -string IffInputFile:: +std::string IffInputFile:: get_string() { - string result; + std::string result; char byte; while (read_byte(byte)) { if (byte == 0) { diff --git a/pandatool/src/lwo/lwoBoundingBox.cxx b/pandatool/src/lwo/lwoBoundingBox.cxx index 8f23e7b403..10ef60a7b0 100644 --- a/pandatool/src/lwo/lwoBoundingBox.cxx +++ b/pandatool/src/lwo/lwoBoundingBox.cxx @@ -39,7 +39,7 @@ read_iff(IffInputFile *in, size_t stop_at) { * */ void LwoBoundingBox:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << get_id() << " { min = " << _min << ", max = " << _max << " }\n"; } diff --git a/pandatool/src/lwo/lwoClip.cxx b/pandatool/src/lwo/lwoClip.cxx index d0bda7993f..fd1e602a0e 100644 --- a/pandatool/src/lwo/lwoClip.cxx +++ b/pandatool/src/lwo/lwoClip.cxx @@ -36,7 +36,7 @@ read_iff(IffInputFile *in, size_t stop_at) { * */ void LwoClip:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << get_id() << " {\n"; indent(out, indent_level + 2) diff --git a/pandatool/src/lwo/lwoDiscontinuousVertexMap.cxx b/pandatool/src/lwo/lwoDiscontinuousVertexMap.cxx index f0cab49c18..3e4b0c003c 100644 --- a/pandatool/src/lwo/lwoDiscontinuousVertexMap.cxx +++ b/pandatool/src/lwo/lwoDiscontinuousVertexMap.cxx @@ -82,7 +82,7 @@ read_iff(IffInputFile *in, size_t stop_at) { } VMap &vmap = _vmad[polygon_index]; - pair ir = + std::pair ir = vmap.insert(VMap::value_type(vertex_index, value)); if (!ir.second) { // This polygonvertex pair was repeated in the vmad. Is it simply @@ -115,7 +115,7 @@ read_iff(IffInputFile *in, size_t stop_at) { * */ void LwoDiscontinuousVertexMap:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << get_id() << " { map_type = " << _map_type << ", dimension = " << _dimension diff --git a/pandatool/src/lwo/lwoGroupChunk.cxx b/pandatool/src/lwo/lwoGroupChunk.cxx index a9bb29fbe7..481f27bb28 100644 --- a/pandatool/src/lwo/lwoGroupChunk.cxx +++ b/pandatool/src/lwo/lwoGroupChunk.cxx @@ -74,7 +74,7 @@ read_subchunks_iff(IffInputFile *in, size_t stop_at) { * debugging), one per line. */ void LwoGroupChunk:: -write_chunks(ostream &out, int indent_level) const { +write_chunks(std::ostream &out, int indent_level) const { Chunks::const_iterator ci; for (ci = _chunks.begin(); ci != _chunks.end(); ++ci) { (*ci)->write(out, indent_level); diff --git a/pandatool/src/lwo/lwoHeader.cxx b/pandatool/src/lwo/lwoHeader.cxx index 4fe302f54d..aba632eb93 100644 --- a/pandatool/src/lwo/lwoHeader.cxx +++ b/pandatool/src/lwo/lwoHeader.cxx @@ -61,7 +61,7 @@ read_iff(IffInputFile *in, size_t stop_at) { * */ void LwoHeader:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << get_id() << " {\n"; indent(out, indent_level + 2) diff --git a/pandatool/src/lwo/lwoInputFile.cxx b/pandatool/src/lwo/lwoInputFile.cxx index 78e7dfa10c..a6737855ea 100644 --- a/pandatool/src/lwo/lwoInputFile.cxx +++ b/pandatool/src/lwo/lwoInputFile.cxx @@ -24,6 +24,8 @@ #include "lwoSurface.h" #include "lwoVertexMap.h" +using std::string; + TypeHandle LwoInputFile::_type_handle; /** diff --git a/pandatool/src/lwo/lwoLayer.cxx b/pandatool/src/lwo/lwoLayer.cxx index 75f4a18606..1fea2cd546 100644 --- a/pandatool/src/lwo/lwoLayer.cxx +++ b/pandatool/src/lwo/lwoLayer.cxx @@ -63,9 +63,9 @@ read_iff(IffInputFile *in, size_t stop_at) { * */ void LwoLayer:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << get_id() << " { number = " << _number << ", flags = 0x" - << hex << _flags << dec << ", pivot = " << _pivot + << std::hex << _flags << std::dec << ", pivot = " << _pivot << ", _name = \"" << _name << "\", _parent = " << _parent << " }\n"; } diff --git a/pandatool/src/lwo/lwoPoints.cxx b/pandatool/src/lwo/lwoPoints.cxx index 875d6e8909..7abfeea668 100644 --- a/pandatool/src/lwo/lwoPoints.cxx +++ b/pandatool/src/lwo/lwoPoints.cxx @@ -58,7 +58,7 @@ read_iff(IffInputFile *in, size_t stop_at) { * */ void LwoPoints:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << get_id() << " { " << _points.size() << " points }\n"; } diff --git a/pandatool/src/lwo/lwoPolygonTags.cxx b/pandatool/src/lwo/lwoPolygonTags.cxx index aef4b051aa..48f81b47e0 100644 --- a/pandatool/src/lwo/lwoPolygonTags.cxx +++ b/pandatool/src/lwo/lwoPolygonTags.cxx @@ -73,7 +73,7 @@ read_iff(IffInputFile *in, size_t stop_at) { * */ void LwoPolygonTags:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << get_id() << " { tag_type = " << _tag_type << ", " << _tmap.size() << " values }\n"; diff --git a/pandatool/src/lwo/lwoPolygons.cxx b/pandatool/src/lwo/lwoPolygons.cxx index 4e51d3ee26..22d03c2121 100644 --- a/pandatool/src/lwo/lwoPolygons.cxx +++ b/pandatool/src/lwo/lwoPolygons.cxx @@ -113,7 +113,7 @@ read_iff(IffInputFile *in, size_t stop_at) { * */ void LwoPolygons:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << get_id() << " { polygon_type = " << _polygon_type << ", " << _polygons.size() << " polygons }\n"; diff --git a/pandatool/src/lwo/lwoStillImage.cxx b/pandatool/src/lwo/lwoStillImage.cxx index 851aa6c8ef..9a31986c43 100644 --- a/pandatool/src/lwo/lwoStillImage.cxx +++ b/pandatool/src/lwo/lwoStillImage.cxx @@ -38,7 +38,7 @@ read_iff(IffInputFile *in, size_t stop_at) { * */ void LwoStillImage:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << get_id() << " { filename = \"" << _filename << "\" }\n"; } diff --git a/pandatool/src/lwo/lwoSurface.cxx b/pandatool/src/lwo/lwoSurface.cxx index edbc67506a..e1318947d9 100644 --- a/pandatool/src/lwo/lwoSurface.cxx +++ b/pandatool/src/lwo/lwoSurface.cxx @@ -41,7 +41,7 @@ read_iff(IffInputFile *in, size_t stop_at) { * */ void LwoSurface:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << get_id() << " {\n"; indent(out, indent_level + 2) diff --git a/pandatool/src/lwo/lwoSurfaceBlock.cxx b/pandatool/src/lwo/lwoSurfaceBlock.cxx index 76babe281c..8dd32652fa 100644 --- a/pandatool/src/lwo/lwoSurfaceBlock.cxx +++ b/pandatool/src/lwo/lwoSurfaceBlock.cxx @@ -54,7 +54,7 @@ read_iff(IffInputFile *in, size_t stop_at) { * */ void LwoSurfaceBlock:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << get_id() << " {\n"; _header->write(out, indent_level + 2); diff --git a/pandatool/src/lwo/lwoSurfaceBlockAxis.cxx b/pandatool/src/lwo/lwoSurfaceBlockAxis.cxx index 8698e9dea5..3390debdea 100644 --- a/pandatool/src/lwo/lwoSurfaceBlockAxis.cxx +++ b/pandatool/src/lwo/lwoSurfaceBlockAxis.cxx @@ -38,7 +38,7 @@ read_iff(IffInputFile *in, size_t stop_at) { * */ void LwoSurfaceBlockAxis:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << get_id() << " { axis = " << (int)_axis << " }\n"; } diff --git a/pandatool/src/lwo/lwoSurfaceBlockChannel.cxx b/pandatool/src/lwo/lwoSurfaceBlockChannel.cxx index 523b379e4b..94dc45c8af 100644 --- a/pandatool/src/lwo/lwoSurfaceBlockChannel.cxx +++ b/pandatool/src/lwo/lwoSurfaceBlockChannel.cxx @@ -38,7 +38,7 @@ read_iff(IffInputFile *in, size_t stop_at) { * */ void LwoSurfaceBlockChannel:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << get_id() << " { channel_id = " << _channel_id << " }\n"; } diff --git a/pandatool/src/lwo/lwoSurfaceBlockCoordSys.cxx b/pandatool/src/lwo/lwoSurfaceBlockCoordSys.cxx index 4e1e3f0766..e2c9b77a84 100644 --- a/pandatool/src/lwo/lwoSurfaceBlockCoordSys.cxx +++ b/pandatool/src/lwo/lwoSurfaceBlockCoordSys.cxx @@ -38,7 +38,7 @@ read_iff(IffInputFile *in, size_t stop_at) { * */ void LwoSurfaceBlockCoordSys:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << get_id() << " { type = " << (int)_type << " }\n"; } diff --git a/pandatool/src/lwo/lwoSurfaceBlockEnabled.cxx b/pandatool/src/lwo/lwoSurfaceBlockEnabled.cxx index c4d01dd557..8240539502 100644 --- a/pandatool/src/lwo/lwoSurfaceBlockEnabled.cxx +++ b/pandatool/src/lwo/lwoSurfaceBlockEnabled.cxx @@ -38,7 +38,7 @@ read_iff(IffInputFile *in, size_t stop_at) { * */ void LwoSurfaceBlockEnabled:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << get_id() << " { enabled = " << _enabled << " }\n"; } diff --git a/pandatool/src/lwo/lwoSurfaceBlockHeader.cxx b/pandatool/src/lwo/lwoSurfaceBlockHeader.cxx index a4a88d982a..69351fa403 100644 --- a/pandatool/src/lwo/lwoSurfaceBlockHeader.cxx +++ b/pandatool/src/lwo/lwoSurfaceBlockHeader.cxx @@ -43,18 +43,18 @@ read_iff(IffInputFile *in, size_t stop_at) { * */ void LwoSurfaceBlockHeader:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << get_id() << " {\n"; indent(out, indent_level + 2) - << "ordinal = 0x" << hex << setfill('0'); + << "ordinal = 0x" << std::hex << std::setfill('0'); - string::const_iterator si; + std::string::const_iterator si; for (si = _ordinal.begin(); si != _ordinal.end(); ++si) { - out << setw(2) << (int)(unsigned char)(*si); + out << std::setw(2) << (int)(unsigned char)(*si); } - out << dec << setfill(' ') << "\n"; + out << std::dec << std::setfill(' ') << "\n"; write_chunks(out, indent_level + 2); indent(out, indent_level) diff --git a/pandatool/src/lwo/lwoSurfaceBlockImage.cxx b/pandatool/src/lwo/lwoSurfaceBlockImage.cxx index dce817b6aa..520d8cef2a 100644 --- a/pandatool/src/lwo/lwoSurfaceBlockImage.cxx +++ b/pandatool/src/lwo/lwoSurfaceBlockImage.cxx @@ -38,7 +38,7 @@ read_iff(IffInputFile *in, size_t stop_at) { * */ void LwoSurfaceBlockImage:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << get_id() << " { index = " << _index << " }\n"; } diff --git a/pandatool/src/lwo/lwoSurfaceBlockOpacity.cxx b/pandatool/src/lwo/lwoSurfaceBlockOpacity.cxx index d6554d0b82..456e1383ca 100644 --- a/pandatool/src/lwo/lwoSurfaceBlockOpacity.cxx +++ b/pandatool/src/lwo/lwoSurfaceBlockOpacity.cxx @@ -40,7 +40,7 @@ read_iff(IffInputFile *in, size_t stop_at) { * */ void LwoSurfaceBlockOpacity:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << get_id() << " { type = " << (int)_type << ", opacity = " << _opacity * 100.0 << "%, envelope = " << _envelope diff --git a/pandatool/src/lwo/lwoSurfaceBlockProjection.cxx b/pandatool/src/lwo/lwoSurfaceBlockProjection.cxx index 2f6d214177..500d90c2ed 100644 --- a/pandatool/src/lwo/lwoSurfaceBlockProjection.cxx +++ b/pandatool/src/lwo/lwoSurfaceBlockProjection.cxx @@ -38,7 +38,7 @@ read_iff(IffInputFile *in, size_t stop_at) { * */ void LwoSurfaceBlockProjection:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << get_id() << " { mode = " << (int)_mode << " }\n"; } diff --git a/pandatool/src/lwo/lwoSurfaceBlockRefObj.cxx b/pandatool/src/lwo/lwoSurfaceBlockRefObj.cxx index d7dccc5693..1c19fedfac 100644 --- a/pandatool/src/lwo/lwoSurfaceBlockRefObj.cxx +++ b/pandatool/src/lwo/lwoSurfaceBlockRefObj.cxx @@ -38,7 +38,7 @@ read_iff(IffInputFile *in, size_t stop_at) { * */ void LwoSurfaceBlockRefObj:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << get_id() << " { name = \"" << _name << "\" }\n"; } diff --git a/pandatool/src/lwo/lwoSurfaceBlockRepeat.cxx b/pandatool/src/lwo/lwoSurfaceBlockRepeat.cxx index e264667caa..9036c143fc 100644 --- a/pandatool/src/lwo/lwoSurfaceBlockRepeat.cxx +++ b/pandatool/src/lwo/lwoSurfaceBlockRepeat.cxx @@ -39,7 +39,7 @@ read_iff(IffInputFile *in, size_t stop_at) { * */ void LwoSurfaceBlockRepeat:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << get_id() << " { cycles = " << _cycles << ", envelope = " << _envelope << " }\n"; diff --git a/pandatool/src/lwo/lwoSurfaceBlockTMap.cxx b/pandatool/src/lwo/lwoSurfaceBlockTMap.cxx index f404910611..1f355d2d4d 100644 --- a/pandatool/src/lwo/lwoSurfaceBlockTMap.cxx +++ b/pandatool/src/lwo/lwoSurfaceBlockTMap.cxx @@ -41,7 +41,7 @@ read_iff(IffInputFile *in, size_t stop_at) { * */ void LwoSurfaceBlockTMap:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << get_id() << " {\n"; write_chunks(out, indent_level + 2); diff --git a/pandatool/src/lwo/lwoSurfaceBlockTransform.cxx b/pandatool/src/lwo/lwoSurfaceBlockTransform.cxx index e2fdccad18..2ed2738161 100644 --- a/pandatool/src/lwo/lwoSurfaceBlockTransform.cxx +++ b/pandatool/src/lwo/lwoSurfaceBlockTransform.cxx @@ -39,7 +39,7 @@ read_iff(IffInputFile *in, size_t stop_at) { * */ void LwoSurfaceBlockTransform:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << get_id() << " { vec = " << _vec << ", envelope = " << _envelope << " }\n"; diff --git a/pandatool/src/lwo/lwoSurfaceBlockVMapName.cxx b/pandatool/src/lwo/lwoSurfaceBlockVMapName.cxx index 208f309e4c..f4db699457 100644 --- a/pandatool/src/lwo/lwoSurfaceBlockVMapName.cxx +++ b/pandatool/src/lwo/lwoSurfaceBlockVMapName.cxx @@ -38,7 +38,7 @@ read_iff(IffInputFile *in, size_t stop_at) { * */ void LwoSurfaceBlockVMapName:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << get_id() << " { name = \"" << _name << "\" }\n"; } diff --git a/pandatool/src/lwo/lwoSurfaceBlockWrap.cxx b/pandatool/src/lwo/lwoSurfaceBlockWrap.cxx index ec7cc24796..006be5f8be 100644 --- a/pandatool/src/lwo/lwoSurfaceBlockWrap.cxx +++ b/pandatool/src/lwo/lwoSurfaceBlockWrap.cxx @@ -39,7 +39,7 @@ read_iff(IffInputFile *in, size_t stop_at) { * */ void LwoSurfaceBlockWrap:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << get_id() << " { width = " << (int)_width << ", height = " << (int)_height << " }\n"; diff --git a/pandatool/src/lwo/lwoSurfaceColor.cxx b/pandatool/src/lwo/lwoSurfaceColor.cxx index ceeb5ab747..5a4526eb55 100644 --- a/pandatool/src/lwo/lwoSurfaceColor.cxx +++ b/pandatool/src/lwo/lwoSurfaceColor.cxx @@ -39,7 +39,7 @@ read_iff(IffInputFile *in, size_t stop_at) { * */ void LwoSurfaceColor:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << get_id() << " { color = " << _color << ", envelope = " << _envelope << " }\n"; diff --git a/pandatool/src/lwo/lwoSurfaceParameter.cxx b/pandatool/src/lwo/lwoSurfaceParameter.cxx index f1ff64203b..fd3543f18a 100644 --- a/pandatool/src/lwo/lwoSurfaceParameter.cxx +++ b/pandatool/src/lwo/lwoSurfaceParameter.cxx @@ -39,7 +39,7 @@ read_iff(IffInputFile *in, size_t stop_at) { * */ void LwoSurfaceParameter:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << get_id() << " { value = " << _value << ", envelope = " << _envelope << " }\n"; diff --git a/pandatool/src/lwo/lwoSurfaceSidedness.cxx b/pandatool/src/lwo/lwoSurfaceSidedness.cxx index b67c1492be..2c773b25f6 100644 --- a/pandatool/src/lwo/lwoSurfaceSidedness.cxx +++ b/pandatool/src/lwo/lwoSurfaceSidedness.cxx @@ -38,7 +38,7 @@ read_iff(IffInputFile *in, size_t stop_at) { * */ void LwoSurfaceSidedness:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << get_id() << " { sidedness = " << (int)_sidedness << " }\n"; } diff --git a/pandatool/src/lwo/lwoSurfaceSmoothingAngle.cxx b/pandatool/src/lwo/lwoSurfaceSmoothingAngle.cxx index 1b0570c46b..49c1f729f5 100644 --- a/pandatool/src/lwo/lwoSurfaceSmoothingAngle.cxx +++ b/pandatool/src/lwo/lwoSurfaceSmoothingAngle.cxx @@ -39,7 +39,7 @@ read_iff(IffInputFile *in, size_t stop_at) { * */ void LwoSurfaceSmoothingAngle:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << get_id() << " { angle = " << rad_2_deg(_angle) << " degrees }\n"; } diff --git a/pandatool/src/lwo/lwoTags.cxx b/pandatool/src/lwo/lwoTags.cxx index c2d9ebbc8d..43eaa2ab70 100644 --- a/pandatool/src/lwo/lwoTags.cxx +++ b/pandatool/src/lwo/lwoTags.cxx @@ -30,9 +30,9 @@ get_num_tags() const { /** * Returns the nth tag of this group. */ -string LwoTags:: +std::string LwoTags:: get_tag(int n) const { - nassertr(n >= 0 && n < (int)_tags.size(), string()); + nassertr(n >= 0 && n < (int)_tags.size(), std::string()); return _tags[n]; } @@ -47,7 +47,7 @@ read_iff(IffInputFile *in, size_t stop_at) { LwoInputFile *lin = DCAST(LwoInputFile, in); while (lin->get_bytes_read() < stop_at && !lin->is_eof()) { - string tag = lin->get_string(); + std::string tag = lin->get_string(); _tags.push_back(tag); } @@ -58,7 +58,7 @@ read_iff(IffInputFile *in, size_t stop_at) { * */ void LwoTags:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << get_id() << " { "; diff --git a/pandatool/src/lwo/lwoVertexMap.cxx b/pandatool/src/lwo/lwoVertexMap.cxx index 396ab91b33..a0ecbf9cd5 100644 --- a/pandatool/src/lwo/lwoVertexMap.cxx +++ b/pandatool/src/lwo/lwoVertexMap.cxx @@ -79,7 +79,7 @@ read_iff(IffInputFile *in, size_t stop_at) { * */ void LwoVertexMap:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << get_id() << " { map_type = " << _map_type << ", dimension = " << _dimension diff --git a/pandatool/src/lwoegg/cLwoPoints.cxx b/pandatool/src/lwoegg/cLwoPoints.cxx index 43f48ee690..93a89f79c6 100644 --- a/pandatool/src/lwoegg/cLwoPoints.cxx +++ b/pandatool/src/lwoegg/cLwoPoints.cxx @@ -26,7 +26,7 @@ void CLwoPoints:: add_vmap(const LwoVertexMap *lwo_vmap) { IffId map_type = lwo_vmap->_map_type; - const string &name = lwo_vmap->_name; + const std::string &name = lwo_vmap->_name; bool inserted; if (map_type == IffId("TXUV")) { @@ -52,7 +52,7 @@ add_vmap(const LwoVertexMap *lwo_vmap) { * given vertex, false otherwise. If true, fills in uv with the value. */ bool CLwoPoints:: -get_uv(const string &uv_name, int n, LPoint2 &uv) const { +get_uv(const std::string &uv_name, int n, LPoint2 &uv) const { VMap::const_iterator ni = _txuv.find(uv_name); if (ni == _txuv.end()) { return false; @@ -82,7 +82,7 @@ void CLwoPoints:: make_egg() { // Generate a vpool name based on the layer index, for lack of anything // better. - string vpool_name = "layer" + format_string(_layer->get_number()); + std::string vpool_name = "layer" + format_string(_layer->get_number()); _egg_vpool = new EggVertexPool(vpool_name); } diff --git a/pandatool/src/lwoegg/cLwoPolygons.cxx b/pandatool/src/lwoegg/cLwoPolygons.cxx index 3f64a6ee83..e6a0fac4cf 100644 --- a/pandatool/src/lwoegg/cLwoPolygons.cxx +++ b/pandatool/src/lwoegg/cLwoPolygons.cxx @@ -25,6 +25,8 @@ #include "eggPoint.h" #include "deg_2_rad.h" +using std::string; + /** * Associates the indicated PolygonTags and Tags with the polygons in this * chunk. This may define features such as per-polygon surfaces, parts, and diff --git a/pandatool/src/lwoegg/cLwoSurface.cxx b/pandatool/src/lwoegg/cLwoSurface.cxx index b3a1c78d1d..63559dd62f 100644 --- a/pandatool/src/lwoegg/cLwoSurface.cxx +++ b/pandatool/src/lwoegg/cLwoSurface.cxx @@ -190,7 +190,7 @@ apply_properties(EggPrimitive *egg_prim, vector_PT_EggVertex &egg_vertices, } if ((_flags & F_smooth_angle) != 0) { - smooth_angle = max(smooth_angle, _smooth_angle); + smooth_angle = std::max(smooth_angle, _smooth_angle); } } diff --git a/pandatool/src/lwoegg/lwoToEggConverter.cxx b/pandatool/src/lwoegg/lwoToEggConverter.cxx index 94aa3b7fe6..42844f19f0 100644 --- a/pandatool/src/lwoegg/lwoToEggConverter.cxx +++ b/pandatool/src/lwoegg/lwoToEggConverter.cxx @@ -69,7 +69,7 @@ make_copy() { /** * Returns the English name of the file type this converter supports. */ -string LwoToEggConverter:: +std::string LwoToEggConverter:: get_name() const { return "Lightwave"; } @@ -77,7 +77,7 @@ get_name() const { /** * Returns the common extension of the file type this converter supports. */ -string LwoToEggConverter:: +std::string LwoToEggConverter:: get_extension() const { return "lwo"; } @@ -182,7 +182,7 @@ get_clip(int number) const { * there is no such surface. */ CLwoSurface *LwoToEggConverter:: -get_surface(const string &name) const { +get_surface(const std::string &name) const { Surfaces::const_iterator si; si = _surfaces.find(name); if (si != _surfaces.end()) { diff --git a/pandatool/src/lwoprogs/lwoScan.cxx b/pandatool/src/lwoprogs/lwoScan.cxx index 5bb0f5a600..c299a3a783 100644 --- a/pandatool/src/lwoprogs/lwoScan.cxx +++ b/pandatool/src/lwoprogs/lwoScan.cxx @@ -48,7 +48,7 @@ run() { nout << "Unable to read file.\n"; } else { while (chunk != nullptr) { - chunk->write(cout, 0); + chunk->write(std::cout, 0); chunk = in.get_chunk(); } } diff --git a/pandatool/src/maxegg/maxEggLoader.cxx b/pandatool/src/maxegg/maxEggLoader.cxx index e2747e6dd0..dca954c6f1 100644 --- a/pandatool/src/maxegg/maxEggLoader.cxx +++ b/pandatool/src/maxegg/maxEggLoader.cxx @@ -39,6 +39,8 @@ #include "maxEggLoader.h" +using std::vector; + class MaxEggMesh; class MaxEggJoint; class MaxEggTex; @@ -64,7 +66,7 @@ public: typedef second_of_pair_iterator MeshIterator; typedef phash_map JointTable; typedef second_of_pair_iterator JointIterator; - typedef phash_map TexTable; + typedef phash_map TexTable; typedef second_of_pair_iterator TexIterator; MeshTable _mesh_tab; @@ -296,7 +298,7 @@ void MaxEggJoint::CreateMaxBone(void) // MaxEggMesh -typedef pair MaxEggWeight; +typedef std::pair MaxEggWeight; struct MaxEggVertex { @@ -344,7 +346,7 @@ class MaxEggMesh { public: - string _name; + std::string _name; TriObject *_obj; Mesh *_mesh; INode *_node; @@ -434,7 +436,7 @@ MaxEggMesh *MaxEggLoader::GetMesh(EggVertexPool *pool) { MaxEggMesh *result = _mesh_tab[pool]; if (result == 0) { - string name = pool->get_name(); + std::string name = pool->get_name(); int nsize = name.size(); if ((nsize > 6) && (name.rfind(".verts")==(nsize-6))) name.resize(nsize-6); diff --git a/pandatool/src/maxegg/maxToEggConverter.cxx b/pandatool/src/maxegg/maxToEggConverter.cxx index 85b909a6e2..41718f66e8 100644 --- a/pandatool/src/maxegg/maxToEggConverter.cxx +++ b/pandatool/src/maxegg/maxToEggConverter.cxx @@ -27,6 +27,8 @@ #include "maxEgg.h" #include "config_putil.h" +using std::string; + /** * */ @@ -704,7 +706,7 @@ make_polyset(INode *max_node, Mesh *mesh, // standard material to the object for (int iChan=0; iChan // for chdir() #endif +using std::string; + MayaApi *MayaApi::_global_api = nullptr; // We need this bogus object just to force the application to link with @@ -255,7 +257,7 @@ read(const Filename &filename) { string dirname = _cwd.to_os_specific(); if (maya_cat.is_debug()) { - maya_cat.debug() << "cwd(read:before): " << dirname.c_str() << endl; + maya_cat.debug() << "cwd(read:before): " << dirname.c_str() << std::endl; } MFileIO::newFile(true); @@ -293,7 +295,7 @@ write(const Filename &filename) { string dirname = _cwd.to_os_specific(); if (maya_cat.is_debug()) { - maya_cat.debug() << "cwd(write:before): " << dirname.c_str() << endl; + maya_cat.debug() << "cwd(write:before): " << dirname.c_str() << std::endl; } const char *type = "mayaBinary"; diff --git a/pandatool/src/maya/mayaShader.cxx b/pandatool/src/maya/mayaShader.cxx index 78484d0be3..9be62a60d3 100644 --- a/pandatool/src/maya/mayaShader.cxx +++ b/pandatool/src/maya/mayaShader.cxx @@ -32,6 +32,9 @@ #include #include "post_maya_include.h" +using std::endl; +using std::string; + /** * Reads the Maya "shading engine" to determine the relevant shader * properties. @@ -92,7 +95,7 @@ MayaShader:: * */ void MayaShader:: -output(ostream &out) const { +output(std::ostream &out) const { out << "Shader " << get_name(); } @@ -100,7 +103,7 @@ output(ostream &out) const { * */ void MayaShader:: -write(ostream &out) const { +write(std::ostream &out) const { out << "Shader " << get_name() << "\n"; } diff --git a/pandatool/src/maya/mayaShaderColorDef.cxx b/pandatool/src/maya/mayaShaderColorDef.cxx index 69aa0cd85e..73d2978d7c 100644 --- a/pandatool/src/maya/mayaShaderColorDef.cxx +++ b/pandatool/src/maya/mayaShaderColorDef.cxx @@ -29,6 +29,9 @@ #include #include "post_maya_include.h" +using std::endl; +using std::string; + /** * */ @@ -177,7 +180,7 @@ project_uv(const LPoint3d &pos, const LPoint3d ¢roid) const { * */ void MayaShaderColorDef:: -write(ostream &out) const { +write(std::ostream &out) const { if (_has_texture) { out << " texture filename is " << _texture_filename << "\n" << " texture name is " << _texture_name << "\n" diff --git a/pandatool/src/maya/mayaShaders.cxx b/pandatool/src/maya/mayaShaders.cxx index 7aecbd3d61..dca3712366 100644 --- a/pandatool/src/maya/mayaShaders.cxx +++ b/pandatool/src/maya/mayaShaders.cxx @@ -27,6 +27,8 @@ #include #include "post_maya_include.h" +using std::string; + /** * */ diff --git a/pandatool/src/maya/maya_funcs.cxx b/pandatool/src/maya/maya_funcs.cxx index 184a903f66..2f21adefb3 100644 --- a/pandatool/src/maya/maya_funcs.cxx +++ b/pandatool/src/maya/maya_funcs.cxx @@ -31,6 +31,9 @@ #include #include "post_maya_include.h" +using std::endl; +using std::string; + /** * Gets the named MPlug associated, if any. */ diff --git a/pandatool/src/mayaegg/mayaBlendDesc.cxx b/pandatool/src/mayaegg/mayaBlendDesc.cxx index c60ecf515a..b396ed86b6 100644 --- a/pandatool/src/mayaegg/mayaBlendDesc.cxx +++ b/pandatool/src/mayaegg/mayaBlendDesc.cxx @@ -24,7 +24,7 @@ MayaBlendDesc(MFnBlendShapeDeformer &deformer, int weight_index) : _deformer(deformer.object()), _weight_index(weight_index) { - ostringstream strm; + std::ostringstream strm; strm << _deformer.name().asChar() << "." << _weight_index; set_name(strm.str()); diff --git a/pandatool/src/mayaegg/mayaEggLoader.cxx b/pandatool/src/mayaegg/mayaEggLoader.cxx index 6664e54aa0..701278b6d6 100644 --- a/pandatool/src/mayaegg/mayaEggLoader.cxx +++ b/pandatool/src/mayaegg/mayaEggLoader.cxx @@ -71,6 +71,12 @@ #include "mayaEggLoader.h" +using std::cerr; +using std::endl; +using std::ostringstream; +using std::string; +using std::vector; + class MayaEggGroup; class MayaEggGeom; class MayaEggMesh; @@ -617,7 +623,7 @@ void MayaEggJoint::CreateMayaBone(MayaEggGroup *eggParent) // MayaEggGeom : base abstract class of MayaEggMesh and MayaEggNurbsSurface -typedef pair MayaEggWeight; +typedef std::pair MayaEggWeight; struct MayaEggVertex { diff --git a/pandatool/src/mayaegg/mayaNodeDesc.cxx b/pandatool/src/mayaegg/mayaNodeDesc.cxx index 9049bf2dc8..8a86f1cb96 100644 --- a/pandatool/src/mayaegg/mayaNodeDesc.cxx +++ b/pandatool/src/mayaegg/mayaNodeDesc.cxx @@ -26,6 +26,8 @@ #include #include "post_maya_include.h" +using std::string; + TypeHandle MayaNodeDesc::_type_handle; // This is a list of the names of Maya connections that count as a transform. @@ -339,7 +341,7 @@ check_pseudo_joints(bool joint_above) { space.append(" "); } if (mayaegg_cat.is_spam()) { - mayaegg_cat.spam() << "cpj:" << space << get_name() << " joint_type: " << _joint_type << endl; + mayaegg_cat.spam() << "cpj:" << space << get_name() << " joint_type: " << _joint_type << std::endl; } if (_joint_type == JT_joint_parent && joint_above) { // This is one such node: it is the parent of a joint (JT_joint_parent is @@ -387,11 +389,11 @@ check_pseudo_joints(bool joint_above) { child->_joint_type = JT_pseudo_joint; } else if (child->_joint_type == JT_none) { if (mayaegg_cat.is_spam()) { - mayaegg_cat.spam() << "cpj: " << space << "jt_none for " << child->get_name() << endl; + mayaegg_cat.spam() << "cpj: " << space << "jt_none for " << child->get_name() << std::endl; } if (type_name.find("transform") == string::npos) { if (mayaegg_cat.is_spam()) { - mayaegg_cat.spam() << "cpj: " << space << "all_joints false for " << get_name() << endl; + mayaegg_cat.spam() << "cpj: " << space << "all_joints false for " << get_name() << std::endl; } all_joints = false; } diff --git a/pandatool/src/mayaegg/mayaNodeTree.cxx b/pandatool/src/mayaegg/mayaNodeTree.cxx index 32a6281725..f80a3c95c1 100644 --- a/pandatool/src/mayaegg/mayaNodeTree.cxx +++ b/pandatool/src/mayaegg/mayaNodeTree.cxx @@ -32,6 +32,8 @@ #include #include "post_maya_include.h" +using std::string; + /** * */ @@ -611,7 +613,7 @@ r_build_node(const string &path) { if (node_desc != _root) { MayaNodeDesc *parent_node_desc = r_build_node(parent_path); if (parent_node_desc == nullptr) - mayaegg_cat.info() << "empty parent: " << local_name << endl; + mayaegg_cat.info() << "empty parent: " << local_name << std::endl; node_desc = new MayaNodeDesc(this, parent_node_desc, local_name); _nodes.push_back(node_desc); } diff --git a/pandatool/src/mayaegg/mayaToEggConverter.cxx b/pandatool/src/mayaegg/mayaToEggConverter.cxx index cefe15e1cc..7943f07f03 100644 --- a/pandatool/src/mayaegg/mayaToEggConverter.cxx +++ b/pandatool/src/mayaegg/mayaToEggConverter.cxx @@ -76,6 +76,9 @@ #include #include "post_maya_include.h" +using std::endl; +using std::string; + /** * @@ -591,7 +594,7 @@ convert_flip(double start_frame, double end_frame, double frame_inc, while (frame <= frame_stop) { mayaegg_cat.info(false) << "frame " << frame.value() << "\n"; - ostringstream name_strm; + std::ostringstream name_strm; name_strm << "frame" << frame.value(); EggGroup *frame_root = new EggGroup(name_strm.str()); sequence_node->add_child(frame_root); diff --git a/pandatool/src/mayaprogs/blend_test.cxx b/pandatool/src/mayaprogs/blend_test.cxx index 5cbd6d413e..ed03fd3661 100644 --- a/pandatool/src/mayaprogs/blend_test.cxx +++ b/pandatool/src/mayaprogs/blend_test.cxx @@ -21,7 +21,7 @@ #include #include -using namespace std; +using std::cerr; void scan_nodes() { @@ -177,7 +177,7 @@ output_vertices(const char *filename, MFnMesh &mesh) { exit(1); } - std::ofstream file(filename, ios::out | ios::trunc); + std::ofstream file(filename, std::ios::out | std::ios::trunc); if (!file) { cerr << "Couldn't open " << filename << " for output.\n"; exit(1); diff --git a/pandatool/src/mayaprogs/mayaCopy.cxx b/pandatool/src/mayaprogs/mayaCopy.cxx index 70cb614a2d..247e0b43ad 100644 --- a/pandatool/src/mayaprogs/mayaCopy.cxx +++ b/pandatool/src/mayaprogs/mayaCopy.cxx @@ -32,6 +32,9 @@ #include #include "post_maya_include.h" +using std::endl; +using std::string; + /** * */ diff --git a/pandatool/src/mayaprogs/mayaEggImport.cxx b/pandatool/src/mayaprogs/mayaEggImport.cxx index 4b4ee413f0..5e38271517 100644 --- a/pandatool/src/mayaprogs/mayaEggImport.cxx +++ b/pandatool/src/mayaprogs/mayaEggImport.cxx @@ -115,7 +115,7 @@ MStatus MayaEggImporter::reader ( const MFileObject& file, std::ostringstream log; Notify::ptr()->set_ostream_ptr(&log, false); bool ok = MayaLoadEggFile(fileName.asChar(), merge, model, anim, false); - string txt = log.str(); + std::string txt = log.str(); if (txt != "") { MGlobal::displayError(txt.c_str()); } else { diff --git a/pandatool/src/mayaprogs/mayaPview.cxx b/pandatool/src/mayaprogs/mayaPview.cxx index 687ec99886..06fc171b14 100644 --- a/pandatool/src/mayaprogs/mayaPview.cxx +++ b/pandatool/src/mayaprogs/mayaPview.cxx @@ -119,13 +119,13 @@ doIt(const MArgList &args) { MProgressWindow::advanceProgress(1); // Now spawn a pview instance to view this temporary file. - string pview_args = "-clD"; + std::string pview_args = "-clD"; if (animate) { pview_args = "-clDa"; } // On Windows, we use the spawn function to run pview asynchronously. - string quoted = string("\"") + bam_filename.get_fullpath() + string("\""); + std::string quoted = std::string("\"") + bam_filename.get_fullpath() + std::string("\""); nout << "pview " << pview_args << " " << quoted << "\n"; int retval = _spawnlp(_P_DETACH, "pview", "pview", pview_args.c_str(), quoted.c_str(), nullptr); @@ -242,7 +242,7 @@ convert(const NodePath &parent, bool animate) { // Accept relative pathnames in the Maya file. Filename source_file = Filename::from_os_specific(MFileIO::currentFile().asChar()); - string source_dir = source_file.get_dirname(); + std::string source_dir = source_file.get_dirname(); if (!source_dir.empty()) { path_replace->_path.append_directory(source_dir); } diff --git a/pandatool/src/mayaprogs/mayaToEgg.cxx b/pandatool/src/mayaprogs/mayaToEgg.cxx index 8d58808a5b..1219f5389a 100644 --- a/pandatool/src/mayaprogs/mayaToEgg.cxx +++ b/pandatool/src/mayaprogs/mayaToEgg.cxx @@ -319,7 +319,7 @@ run() { * option. */ bool MayaToEgg:: -dispatch_transform_type(const string &opt, const string &arg, void *var) { +dispatch_transform_type(const std::string &opt, const std::string &arg, void *var) { MayaToEggConverter::TransformType *ip = (MayaToEggConverter::TransformType *)var; (*ip) = MayaToEggConverter::string_transform_type(arg); diff --git a/pandatool/src/mayaprogs/mayaToEgg_client.cxx b/pandatool/src/mayaprogs/mayaToEgg_client.cxx index dfde2661c1..a92e6195ec 100644 --- a/pandatool/src/mayaprogs/mayaToEgg_client.cxx +++ b/pandatool/src/mayaprogs/mayaToEgg_client.cxx @@ -41,7 +41,7 @@ int main(int argc, char *argv[]) { // Get the current working directory and make sure it's a string Filename cwd = ExecutionEnvironment::get_cwd(); - string s_cwd = (string)cwd.to_os_specific(); + std::string s_cwd = (std::string)cwd.to_os_specific(); NetDatagram datagram; // First part of the datagram is the argc diff --git a/pandatool/src/mayaprogs/mayaToEgg_server.cxx b/pandatool/src/mayaprogs/mayaToEgg_server.cxx index 8b97d920a4..e95118d33b 100644 --- a/pandatool/src/mayaprogs/mayaToEgg_server.cxx +++ b/pandatool/src/mayaprogs/mayaToEgg_server.cxx @@ -329,7 +329,7 @@ run() { * option. */ bool MayaToEggServer:: -dispatch_transform_type(const string &opt, const string &arg, void *var) { +dispatch_transform_type(const std::string &opt, const std::string &arg, void *var) { MayaToEggConverter::TransformType *ip = (MayaToEggConverter::TransformType *)var; (*ip) = MayaToEggConverter::string_transform_type(arg); @@ -389,7 +389,7 @@ poll() { // track of all the pointers we're gonna malloc. Needed later for // cleanup. vector_string vargv; - vector buffers; + std::vector buffers; // Get the strings from the datagram and put them into the string vector int i; @@ -399,7 +399,7 @@ poll() { // Last string is the current directory the client was run from. Not // part of the argument list, but we still need it - string cwd = data.get_string(); + std::string cwd = data.get_string(); // We allocate some memory to hold the pointers to the pointers we're // going to pass in to parse_command_line(). @@ -439,7 +439,7 @@ poll() { vargv.clear(); // No, iterate through the char * vector and cleanup the malloc'd // pointers - vector::iterator vi; + std::vector::iterator vi; for ( vi = buffers.begin() ; vi != buffers.end(); vi++) { free(*vi); } diff --git a/pandatool/src/mayaprogs/mayapath.cxx b/pandatool/src/mayaprogs/mayapath.cxx index cac021eebe..ae9ad39ac2 100644 --- a/pandatool/src/mayaprogs/mayapath.cxx +++ b/pandatool/src/mayaprogs/mayapath.cxx @@ -51,6 +51,10 @@ #include #endif +using std::cerr; +using std::endl; +using std::string; + #define QUOTESTR(x) #x #define TOSTRING(x) QUOTESTR(x) diff --git a/pandatool/src/mayaprogs/normal_test.cxx b/pandatool/src/mayaprogs/normal_test.cxx index ca1b4638eb..41680254de 100644 --- a/pandatool/src/mayaprogs/normal_test.cxx +++ b/pandatool/src/mayaprogs/normal_test.cxx @@ -23,7 +23,8 @@ #include #include -using namespace std; +using std::cerr; +using std::endl; void scan_nodes() { diff --git a/pandatool/src/miscprogs/binToC.cxx b/pandatool/src/miscprogs/binToC.cxx index 44eddfb1ac..f963c08986 100644 --- a/pandatool/src/miscprogs/binToC.cxx +++ b/pandatool/src/miscprogs/binToC.cxx @@ -73,13 +73,13 @@ run() { } std::ostream &out = get_output(); - string static_keyword; + std::string static_keyword; if (_static_table) { static_keyword = "static "; } - string table_type = "const unsigned char "; - string length_type = "const int "; + std::string table_type = "const unsigned char "; + std::string length_type = "const int "; if (_for_string) { // Actually, declaring the table as "const char" causes VC7 to yell about // truncating all of the values >= 0x80. table_type = "const char "; @@ -96,7 +96,7 @@ run() { << "#include \n" << "\n" << static_keyword << table_type << _table_name << "[] = {"; - out << hex << setfill('0'); + out << std::hex << std::setfill('0'); int count = 0; int col = 0; unsigned int ch; @@ -110,14 +110,14 @@ run() { } else { out << ", "; } - out << "0x" << setw(2) << ch; + out << "0x" << std::setw(2) << ch; col++; count++; ch = in.get(); } out << "\n};\n\n" << static_keyword << length_type << _table_name << "_len = " - << dec << count << ";\n\n"; + << std::dec << count << ";\n\n"; } /** diff --git a/pandatool/src/objegg/eggToObjConverter.cxx b/pandatool/src/objegg/eggToObjConverter.cxx index 96505e7f35..a03630698c 100644 --- a/pandatool/src/objegg/eggToObjConverter.cxx +++ b/pandatool/src/objegg/eggToObjConverter.cxx @@ -23,6 +23,9 @@ #include "eggLine.h" #include "dcast.h" +using std::ostream; +using std::string; + /** * */ diff --git a/pandatool/src/objegg/objToEggConverter.cxx b/pandatool/src/objegg/objToEggConverter.cxx index 05af8ce1a2..7278a32dc9 100644 --- a/pandatool/src/objegg/objToEggConverter.cxx +++ b/pandatool/src/objegg/objToEggConverter.cxx @@ -27,6 +27,8 @@ #include "triangulator3.h" #include "config_egg2pg.h" +using std::string; + /** * */ @@ -147,7 +149,7 @@ convert_to_node(const LoaderOptions &options, const Filename &filename) { bool ObjToEggConverter:: process(const Filename &filename) { VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr(); - istream *strm = vfs->open_read_file(filename, true); + std::istream *strm = vfs->open_read_file(filename, true); if (strm == nullptr) { objegg_cat.error() << "Couldn't read " << filename << "\n"; @@ -552,7 +554,7 @@ generate_egg_points() { bool ObjToEggConverter:: process_node(const Filename &filename) { VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr(); - istream *strm = vfs->open_read_file(filename, true); + std::istream *strm = vfs->open_read_file(filename, true); if (strm == nullptr) { objegg_cat.error() << "Couldn't read " << filename << "\n"; @@ -799,7 +801,7 @@ generate_points() { */ int ObjToEggConverter:: add_synth_normal(const LVecBase3d &normal) { - pair result = _unique_synth_vn_table.insert(UniqueVec3Table::value_type(normal, _unique_synth_vn_table.size())); + std::pair result = _unique_synth_vn_table.insert(UniqueVec3Table::value_type(normal, _unique_synth_vn_table.size())); UniqueVec3Table::iterator ni = result.first; int index = (*ni).second; @@ -895,7 +897,7 @@ VertexData(PandaNode *parent, const string &name) : */ int ObjToEggConverter::VertexData:: add_vertex(const ObjToEggConverter *converter, const VertexEntry &entry) { - pair result; + std::pair result; UniqueVertexEntries::iterator ni; int index; diff --git a/pandatool/src/palettizer/destTextureImage.cxx b/pandatool/src/palettizer/destTextureImage.cxx index b1b3c1853b..38f9a879d1 100644 --- a/pandatool/src/palettizer/destTextureImage.cxx +++ b/pandatool/src/palettizer/destTextureImage.cxx @@ -48,8 +48,8 @@ DestTextureImage(TexturePlacement *placement) { _x_size = to_power_2(_x_size); _y_size = to_power_2(_y_size); } else { - _x_size = max(_x_size, 1); - _y_size = max(_y_size, 1); + _x_size = std::max(_x_size, 1); + _y_size = std::max(_y_size, 1); } } diff --git a/pandatool/src/palettizer/eggFile.cxx b/pandatool/src/palettizer/eggFile.cxx index 1b9e20e9e8..40376a7988 100644 --- a/pandatool/src/palettizer/eggFile.cxx +++ b/pandatool/src/palettizer/eggFile.cxx @@ -57,7 +57,7 @@ bool EggFile:: from_command_line(EggData *data, const Filename &source_filename, const Filename &dest_filename, - const string &egg_comment) { + const std::string &egg_comment) { _data = data; _had_data = true; remove_backstage(_data); @@ -588,7 +588,7 @@ write_egg() { * the indicated output stream. */ void EggFile:: -write_description(ostream &out, int indent_level) const { +write_description(std::ostream &out, int indent_level) const { indent(out, indent_level) << get_name() << ": "; if (_explicitly_assigned_groups.empty()) { if (_default_group != nullptr) { @@ -609,7 +609,7 @@ write_description(ostream &out, int indent_level) const { * per line. */ void EggFile:: -write_texture_refs(ostream &out, int indent_level) const { +write_texture_refs(std::ostream &out, int indent_level) const { Textures::const_iterator ti; for (ti = _textures.begin(); ti != _textures.end(); ++ti) { TextureReference *reference = (*ti); @@ -663,7 +663,7 @@ rescan_textures() { // Make sure each tref name is unique within a given file. tc.uniquify_trefs(); - typedef pmap ByTRefName; + typedef pmap ByTRefName; ByTRefName by_tref_name; for (Textures::const_iterator ti = _textures.begin(); ti != _textures.end(); diff --git a/pandatool/src/palettizer/imageFile.cxx b/pandatool/src/palettizer/imageFile.cxx index eb2409aab6..15a5ebc4e6 100644 --- a/pandatool/src/palettizer/imageFile.cxx +++ b/pandatool/src/palettizer/imageFile.cxx @@ -24,6 +24,8 @@ #include "bamReader.h" #include "bamWriter.h" +using std::string; + TypeHandle ImageFile::_type_handle; /** @@ -419,7 +421,7 @@ update_egg_tex(EggTexture *egg_tex) const { * Writes the filename (or pair of filenames) to the indicated output stream. */ void ImageFile:: -output_filename(ostream &out) const { +output_filename(std::ostream &out) const { out << FilenameUnifier::make_user_filename(_filename); if (_properties.uses_alpha() && !_alpha_filename.empty()) { out << " " << FilenameUnifier::make_user_filename(_alpha_filename); diff --git a/pandatool/src/palettizer/omitReason.cxx b/pandatool/src/palettizer/omitReason.cxx index 94848b865c..6bc14240f4 100644 --- a/pandatool/src/palettizer/omitReason.cxx +++ b/pandatool/src/palettizer/omitReason.cxx @@ -13,8 +13,8 @@ #include "omitReason.h" -ostream & -operator << (ostream &out, OmitReason omit) { +std::ostream & +operator << (std::ostream &out, OmitReason omit) { switch (omit) { case OR_none: return out << "none"; diff --git a/pandatool/src/palettizer/pal_string_utils.cxx b/pandatool/src/palettizer/pal_string_utils.cxx index be747e4106..279a7aad47 100644 --- a/pandatool/src/palettizer/pal_string_utils.cxx +++ b/pandatool/src/palettizer/pal_string_utils.cxx @@ -16,6 +16,8 @@ #include "pnmFileType.h" #include "pnmFileTypeRegistry.h" +using std::string; + // Extracts the first word of the string into param, and the remainder of the // line into value. diff --git a/pandatool/src/palettizer/paletteGroup.cxx b/pandatool/src/palettizer/paletteGroup.cxx index 409bf28f33..182479216f 100644 --- a/pandatool/src/palettizer/paletteGroup.cxx +++ b/pandatool/src/palettizer/paletteGroup.cxx @@ -26,6 +26,8 @@ #include "indirectCompareNames.h" #include "pvector.h" +using std::string; + TypeHandle PaletteGroup::_type_handle; /** @@ -454,7 +456,7 @@ update_unknown_textures(const TxaFile &txa_file) { * their textures, to the indicated output stream. */ void PaletteGroup:: -write_image_info(ostream &out, int indent_level) const { +write_image_info(std::ostream &out, int indent_level) const { Pages::const_iterator pai; for (pai = _pages.begin(); pai != _pages.end(); ++pai) { PalettePage *page = (*pai).second; diff --git a/pandatool/src/palettizer/paletteGroups.cxx b/pandatool/src/palettizer/paletteGroups.cxx index ae1f810d5e..c964f2b057 100644 --- a/pandatool/src/palettizer/paletteGroups.cxx +++ b/pandatool/src/palettizer/paletteGroups.cxx @@ -213,7 +213,7 @@ end() const { * */ void PaletteGroups:: -output(ostream &out) const { +output(std::ostream &out) const { if (!_groups.empty()) { // Sort the group names into order by name for output. pvector group_vector; @@ -239,7 +239,7 @@ output(ostream &out) const { * */ void PaletteGroups:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { // Sort the group names into order by name for output. pvector group_vector; group_vector.reserve(_groups.size()); diff --git a/pandatool/src/palettizer/paletteImage.cxx b/pandatool/src/palettizer/paletteImage.cxx index ee2ae01856..871b71ca40 100644 --- a/pandatool/src/palettizer/paletteImage.cxx +++ b/pandatool/src/palettizer/paletteImage.cxx @@ -476,7 +476,7 @@ resize_swapped_image(int x_size, int y_size) { * indicated output stream, one per line. */ void PaletteImage:: -write_placements(ostream &out, int indent_level) const { +write_placements(std::ostream &out, int indent_level) const { Placements::const_iterator pi; for (pi = _placements.begin(); pi != _placements.end(); ++pi) { TexturePlacement *placement = (*pi); @@ -712,9 +712,9 @@ bool PaletteImage:: setup_filename() { // Build up the basename for the palette image, based on the supplied image // pattern. - _basename = string(); + _basename = std::string(); - string::iterator si = pal->_generated_image_pattern.begin(); + std::string::iterator si = pal->_generated_image_pattern.begin(); while (si != pal->_generated_image_pattern.end()) { if ((*si) == '%') { // Some keycode. @@ -800,7 +800,7 @@ find_hole(int &x, int &y, int x_size, int y_size) const { } next_x = overlap->get_placed_x() + overlap->get_placed_x_size(); - next_y = min(next_y, overlap->get_placed_y() + overlap->get_placed_y_size()); + next_y = std::min(next_y, overlap->get_placed_y() + overlap->get_placed_y_size()); nassertr(next_x > x, false); x = next_x; } diff --git a/pandatool/src/palettizer/palettePage.cxx b/pandatool/src/palettizer/palettePage.cxx index adc73c660f..9bdc74c57e 100644 --- a/pandatool/src/palettizer/palettePage.cxx +++ b/pandatool/src/palettizer/palettePage.cxx @@ -141,7 +141,7 @@ unplace(TexturePlacement *placement) { * their textures, to the indicated output stream. */ void PalettePage:: -write_image_info(ostream &out, int indent_level) const { +write_image_info(std::ostream &out, int indent_level) const { Images::const_iterator ii; for (ii = _images.begin(); ii != _images.end(); ++ii) { PaletteImage *image = (*ii); diff --git a/pandatool/src/palettizer/palettizer.cxx b/pandatool/src/palettizer/palettizer.cxx index 3244fd396a..157c267730 100644 --- a/pandatool/src/palettizer/palettizer.cxx +++ b/pandatool/src/palettizer/palettizer.cxx @@ -29,6 +29,9 @@ #include "bamWriter.h" #include "indent.h" +using std::cout; +using std::string; + Palettizer *pal = nullptr; // This number is written out as the first number to the pi file, to indicate @@ -60,7 +63,7 @@ int Palettizer::_read_pi_version = 0; TypeHandle Palettizer::_type_handle; -ostream &operator << (ostream &out, Palettizer::RemapUV remap) { +std::ostream &operator << (std::ostream &out, Palettizer::RemapUV remap) { switch (remap) { case Palettizer::RU_never: return out << "never"; @@ -347,7 +350,7 @@ report_statistics() const { * files. */ void Palettizer:: -read_txa_file(istream &txa_file, const string &txa_filename) { +read_txa_file(std::istream &txa_file, const string &txa_filename) { // Clear out the group dependencies, in preparation for reading them again // from the .txa file. Groups::iterator gi; @@ -890,7 +893,7 @@ string_remap(const string &str) { * texture placements, and reports this to the indicated output stream. */ void Palettizer:: -compute_statistics(ostream &out, int indent_level, +compute_statistics(std::ostream &out, int indent_level, const Palettizer::Placements &placements) const { TextureMemoryCounter counter; @@ -1021,7 +1024,7 @@ complete_pointers(TypedWritable **p_list, BamReader *manager) { DCAST_INTO_R(texture, p_list[index], index); string name = downcase(texture->get_name()); - pair result = _textures.insert(Textures::value_type(name, texture)); + std::pair result = _textures.insert(Textures::value_type(name, texture)); if (!result.second) { // Two textures mapped to the same slot--probably a case error (since we // just changed this rule). diff --git a/pandatool/src/palettizer/textureImage.cxx b/pandatool/src/palettizer/textureImage.cxx index f33d01c408..612aa5b3c6 100644 --- a/pandatool/src/palettizer/textureImage.cxx +++ b/pandatool/src/palettizer/textureImage.cxx @@ -31,6 +31,8 @@ #include +using std::string; + TypeHandle TextureImage::_type_handle; /** @@ -661,7 +663,7 @@ copy_unplaced(bool redo_all) { Filename filename = dest->get_filename(); FilenameUnifier::make_canonical(filename); - pair insert_result = generate.insert + std::pair insert_result = generate.insert (Dests::value_type(filename, dest)); if (!insert_result.second) { // At least two DestTextureImages map to the same filename, no sweat. @@ -780,7 +782,7 @@ is_newer_than(const Filename &reference_filename) { * to the indicated output stream, one per line. */ void TextureImage:: -write_source_pathnames(ostream &out, int indent_level) const { +write_source_pathnames(std::ostream &out, int indent_level) const { Sources::const_iterator si; for (si = _sources.begin(); si != _sources.end(); ++si) { SourceTextureImage *source = (*si).second; @@ -853,7 +855,7 @@ write_source_pathnames(ostream &out, int indent_level) const { * Writes the information about the texture's size and placement. */ void TextureImage:: -write_scale_info(ostream &out, int indent_level) { +write_scale_info(std::ostream &out, int indent_level) { SourceTextureImage *source = get_preferred_source(); indent(out, indent_level) << get_name(); diff --git a/pandatool/src/palettizer/textureMemoryCounter.cxx b/pandatool/src/palettizer/textureMemoryCounter.cxx index 3c3f78b571..91281670c6 100644 --- a/pandatool/src/palettizer/textureMemoryCounter.cxx +++ b/pandatool/src/palettizer/textureMemoryCounter.cxx @@ -81,7 +81,7 @@ add_placement(TexturePlacement *placement) { * Reports the measured texture memory usage. */ void TextureMemoryCounter:: -report(ostream &out, int indent_level) { +report(std::ostream &out, int indent_level) { indent(out, indent_level) << _num_placed << " of " << _num_textures << " textures appear on " << _num_palettes << " palette images with " << _num_unplaced @@ -120,8 +120,8 @@ report(ostream &out, int indent_level) { * Writes to the indicated ostream an indication of the fraction of the total * memory usage that is represented by fraction_bytes. */ -ostream &TextureMemoryCounter:: -format_memory_fraction(ostream &out, int fraction_bytes, int palette_bytes) { +std::ostream &TextureMemoryCounter:: +format_memory_fraction(std::ostream &out, int fraction_bytes, int palette_bytes) { out << floor(1000.0 * (double)fraction_bytes / (double)palette_bytes + 0.5) / 10.0 << "% (" << (fraction_bytes + 512) / 1024 << "k)"; return out; @@ -156,7 +156,7 @@ add_palette(PaletteImage *image) { */ void TextureMemoryCounter:: add_texture(TextureImage *texture, int bytes) { - pair result; + std::pair result; result = _textures.insert(Textures::value_type(texture, bytes)); if (result.second) { // If it was inserted, no problem--no duplicates. @@ -167,8 +167,8 @@ add_texture(TextureImage *texture, int bytes) { // If it was not inserted, we have a duplicate. Textures::iterator ti = result.first; - _duplicate_bytes += min(bytes, (*ti).second); - (*ti).second = max(bytes, (*ti).second); + _duplicate_bytes += std::min(bytes, (*ti).second); + (*ti).second = std::max(bytes, (*ti).second); } /** diff --git a/pandatool/src/palettizer/texturePlacement.cxx b/pandatool/src/palettizer/texturePlacement.cxx index 36331ed233..01f47b42a1 100644 --- a/pandatool/src/palettizer/texturePlacement.cxx +++ b/pandatool/src/palettizer/texturePlacement.cxx @@ -27,6 +27,9 @@ #include "bamWriter.h" #include "pnmImage.h" +using std::max; +using std::min; + TypeHandle TexturePlacement::_type_handle; /** @@ -88,7 +91,7 @@ TexturePlacement:: /** * Returns the name of the texture that this placement represents. */ -const string &TexturePlacement:: +const std::string &TexturePlacement:: get_name() const { return _texture->get_name(); } @@ -640,7 +643,7 @@ compute_tex_matrix(LMatrix3d &transform) { * Writes the placement position information on a line by itself. */ void TexturePlacement:: -write_placed(ostream &out, int indent_level) { +write_placed(std::ostream &out, int indent_level) { indent(out, indent_level) << get_texture()->get_name(); diff --git a/pandatool/src/palettizer/textureProperties.cxx b/pandatool/src/palettizer/textureProperties.cxx index 9538b85165..573dd784b3 100644 --- a/pandatool/src/palettizer/textureProperties.cxx +++ b/pandatool/src/palettizer/textureProperties.cxx @@ -20,6 +20,8 @@ #include "bamWriter.h" #include "string_utils.h" +using std::string; + TypeHandle TextureProperties::_type_handle; /** @@ -183,7 +185,7 @@ get_string() const { string result; if (_got_num_channels) { - ostringstream num; + std::ostringstream num; num << _effective_num_channels; result += num.str(); } diff --git a/pandatool/src/palettizer/textureReference.cxx b/pandatool/src/palettizer/textureReference.cxx index 7bb869c336..4a11b5348d 100644 --- a/pandatool/src/palettizer/textureReference.cxx +++ b/pandatool/src/palettizer/textureReference.cxx @@ -35,6 +35,10 @@ #include +using std::max; +using std::min; +using std::string; + TypeHandle TextureReference::_type_handle; /** @@ -455,7 +459,7 @@ apply_properties_to_source() { * */ void TextureReference:: -output(ostream &out) const { +output(std::ostream &out) const { out << *_source_texture; } @@ -463,7 +467,7 @@ output(ostream &out) const { * */ void TextureReference:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { indent(out, indent_level) << get_texture()->get_name(); diff --git a/pandatool/src/palettizer/txaFile.cxx b/pandatool/src/palettizer/txaFile.cxx index 7aff6ad221..cb4cb5331d 100644 --- a/pandatool/src/palettizer/txaFile.cxx +++ b/pandatool/src/palettizer/txaFile.cxx @@ -20,6 +20,8 @@ #include "pnotify.h" #include "pnmFileTypeRegistry.h" +using std::string; + /** * */ @@ -32,7 +34,7 @@ TxaFile() { * there is an error. */ bool TxaFile:: -read(istream &in, const string &filename) { +read(std::istream &in, const string &filename) { string line; int line_number = 1; @@ -160,7 +162,7 @@ match_texture(TextureImage *texture) const { * output stream. This is primarily useful for debugging. */ void TxaFile:: -write(ostream &out) const { +write(std::ostream &out) const { Lines::const_iterator li; for (li = _lines.begin(); li != _lines.end(); ++li) { out << (*li) << "\n"; @@ -173,7 +175,7 @@ write(ostream &out) const { * line, or EOF if the end of file has been reached. */ int TxaFile:: -get_line_or_semicolon(istream &in, string &line) { +get_line_or_semicolon(std::istream &in, string &line) { line = string(); int ch = in.get(); char semicolon = ';'; diff --git a/pandatool/src/palettizer/txaLine.cxx b/pandatool/src/palettizer/txaLine.cxx index 51a1532610..41f9349c51 100644 --- a/pandatool/src/palettizer/txaLine.cxx +++ b/pandatool/src/palettizer/txaLine.cxx @@ -22,6 +22,8 @@ #include "pnotify.h" #include "pnmFileType.h" +using std::string; + /** * */ @@ -410,8 +412,8 @@ match_texture(TextureImage *texture) const { case ST_scale: if (source != nullptr && source->get_size()) { request._got_size = true; - request._x_size = max(1, (int)(source->get_x_size() * _scale / 100.0)); - request._y_size = max(1, (int)(source->get_y_size() * _scale / 100.0)); + request._x_size = std::max(1, (int)(source->get_x_size() * _scale / 100.0)); + request._y_size = std::max(1, (int)(source->get_y_size() * _scale / 100.0)); } break; @@ -523,7 +525,7 @@ match_texture(TextureImage *texture) const { * */ void TxaLine:: -output(ostream &out) const { +output(std::ostream &out) const { Patterns::const_iterator pi; for (pi = _texture_patterns.begin(); pi != _texture_patterns.end(); ++pi) { out << (*pi) << " "; diff --git a/pandatool/src/pandatoolbase/animationConvert.cxx b/pandatool/src/pandatoolbase/animationConvert.cxx index 6403da48cd..d09ce0f19f 100644 --- a/pandatool/src/pandatoolbase/animationConvert.cxx +++ b/pandatool/src/pandatoolbase/animationConvert.cxx @@ -19,7 +19,7 @@ /** * Returns the string corresponding to this method. */ -string +std::string format_animation_convert(AnimationConvert convert) { switch (convert) { case AC_invalid: @@ -53,8 +53,8 @@ format_animation_convert(AnimationConvert convert) { /** * */ -ostream & -operator << (ostream &out, AnimationConvert convert) { +std::ostream & +operator << (std::ostream &out, AnimationConvert convert) { return out << format_animation_convert(convert); } @@ -63,7 +63,7 @@ operator << (ostream &out, AnimationConvert convert) { * AnimationConvert types. Returns AC_invalid if the string is unknown. */ AnimationConvert -string_animation_convert(const string &str) { +string_animation_convert(const std::string &str) { if (cmp_nocase(str, "none") == 0) { return AC_none; diff --git a/pandatool/src/pandatoolbase/distanceUnit.cxx b/pandatool/src/pandatoolbase/distanceUnit.cxx index d2479de244..8ee495be3c 100644 --- a/pandatool/src/pandatoolbase/distanceUnit.cxx +++ b/pandatool/src/pandatoolbase/distanceUnit.cxx @@ -16,6 +16,10 @@ #include "string_utils.h" #include "pnotify.h" +using std::istream; +using std::ostream; +using std::string; + /** * Returns the string representing the common abbreviation for the given unit. */ diff --git a/pandatool/src/pandatoolbase/pathReplace.cxx b/pandatool/src/pandatoolbase/pathReplace.cxx index c3891cf047..b3b6bcb498 100644 --- a/pandatool/src/pandatoolbase/pathReplace.cxx +++ b/pandatool/src/pandatoolbase/pathReplace.cxx @@ -354,7 +354,7 @@ full_convert_path(const Filename &orig_filename, * */ void PathReplace:: -write(ostream &out, int indent_level) const { +write(std::ostream &out, int indent_level) const { Entries::const_iterator ei; for (ei = _entries.begin(); ei != _entries.end(); ++ei) { indent(out, indent_level) @@ -451,7 +451,7 @@ copy_this_file(Filename &filename) { * */ PathReplace::Entry:: -Entry(const string &orig_prefix, const string &replacement_prefix) : +Entry(const std::string &orig_prefix, const std::string &replacement_prefix) : _orig_prefix(orig_prefix), _replacement_prefix(replacement_prefix) { @@ -495,7 +495,7 @@ try_match(const Filename &filename, Filename &new_filename) const { } // We found a match. Construct the replacement string. - string result = _replacement_prefix; + std::string result = _replacement_prefix; while (mi < components.size()) { if (!result.empty()) { result += '/'; diff --git a/pandatool/src/pandatoolbase/pathStore.cxx b/pandatool/src/pandatoolbase/pathStore.cxx index d40fe3f276..dffacfe678 100644 --- a/pandatool/src/pandatoolbase/pathStore.cxx +++ b/pandatool/src/pandatoolbase/pathStore.cxx @@ -19,7 +19,7 @@ /** * Returns the string corresponding to this method. */ -string +std::string format_path_store(PathStore store) { switch (store) { case PS_invalid: @@ -47,8 +47,8 @@ format_path_store(PathStore store) { /** * */ -ostream & -operator << (ostream &out, PathStore store) { +std::ostream & +operator << (std::ostream &out, PathStore store) { return out << format_path_store(store); } @@ -57,7 +57,7 @@ operator << (ostream &out, PathStore store) { * PathStore types. Returns PS_invalid if the string is unknown. */ PathStore -string_path_store(const string &str) { +string_path_store(const std::string &str) { if (cmp_nocase(str, "relative") == 0 || cmp_nocase(str, "rel") == 0) { return PS_relative; diff --git a/pandatool/src/pfmprogs/pfmBba.cxx b/pandatool/src/pfmprogs/pfmBba.cxx index 30804d8fea..ce0851a47f 100644 --- a/pandatool/src/pfmprogs/pfmBba.cxx +++ b/pandatool/src/pfmprogs/pfmBba.cxx @@ -77,7 +77,7 @@ process_pfm(const Filename &input_filename, PfmFile &file) { pofstream out; if (!bba_filename.open_write(out)) { - cerr << "Unable to open " << bba_filename << "\n"; + std::cerr << "Unable to open " << bba_filename << "\n"; return false; } diff --git a/pandatool/src/pfmprogs/pfmTrans.cxx b/pandatool/src/pfmprogs/pfmTrans.cxx index fdf803b601..ffb99b2472 100644 --- a/pandatool/src/pfmprogs/pfmTrans.cxx +++ b/pandatool/src/pfmprogs/pfmTrans.cxx @@ -21,6 +21,8 @@ #include "string_utils.h" #include "pandaFileStream.h" +using std::string; + /** * */ diff --git a/pandatool/src/progbase/programBase.cxx b/pandatool/src/progbase/programBase.cxx index e97a536127..9cdb70263d 100644 --- a/pandatool/src/progbase/programBase.cxx +++ b/pandatool/src/progbase/programBase.cxx @@ -45,6 +45,12 @@ #endif // TIOCGWINSZ #endif // IOCTL_TERMINAL_WIDTH +using std::cerr; +using std::cout; +using std::max; +using std::min; +using std::string; + bool ProgramBase::SortOptionsByIndex:: operator () (const Option *a, const Option *b) const { if (a->_index_group != b->_index_group) { @@ -181,7 +187,7 @@ show_text(const string &prefix, int indent_width, string text) { * This is useful when creating a man page for this utility. */ void ProgramBase:: -write_man_page(ostream &out) { +write_man_page(std::ostream &out) { string prog = _program_name.get_basename_wo_extension(); out << ".\\\" Automatically generated by " << prog << " -write-man\n"; @@ -296,7 +302,7 @@ parse_command_line(int argc, char **argv) { write_man_page(cout); } else { - pofstream man_out(argv[2], ios::out | ios::trunc); + pofstream man_out(argv[2], std::ios::out | std::ios::trunc); if (!man_out) { cerr << "Failed to open output file " << argv[2] << "!\n"; } @@ -1277,7 +1283,7 @@ handle_help_option(const string &, const string &, void *data) { * doubled newlines. */ void ProgramBase:: -format_text(ostream &out, bool &last_newline, +format_text(std::ostream &out, bool &last_newline, const string &prefix, int indent_width, const string &text, int line_width) { indent_width = min(indent_width, line_width - 20); diff --git a/pandatool/src/progbase/withOutputFile.cxx b/pandatool/src/progbase/withOutputFile.cxx index b88dec05d8..04e5005f0e 100644 --- a/pandatool/src/progbase/withOutputFile.cxx +++ b/pandatool/src/progbase/withOutputFile.cxx @@ -46,7 +46,7 @@ WithOutputFile:: * Returns an output stream that corresponds to the user's intended egg file * output--either stdout, or the named output file. */ -ostream &WithOutputFile:: +std::ostream &WithOutputFile:: get_output() { if (_output_ptr == nullptr) { if (!_got_output_filename) { @@ -55,7 +55,7 @@ get_output() { nout << "No output filename specified.\n"; exit(1); } - _output_ptr = &cout; + _output_ptr = &std::cout; _owns_output_ptr = false; } else { diff --git a/pandatool/src/progbase/wordWrapStream.cxx b/pandatool/src/progbase/wordWrapStream.cxx index a3ac50b99b..cd069d1eaa 100644 --- a/pandatool/src/progbase/wordWrapStream.cxx +++ b/pandatool/src/progbase/wordWrapStream.cxx @@ -19,7 +19,7 @@ */ WordWrapStream:: WordWrapStream(ProgramBase *program) : - ostream(&_lsb), + std::ostream(&_lsb), _lsb(this, program) { } diff --git a/pandatool/src/progbase/wordWrapStreamBuf.cxx b/pandatool/src/progbase/wordWrapStreamBuf.cxx index f8f4dced30..0e0c4abbcb 100644 --- a/pandatool/src/progbase/wordWrapStreamBuf.cxx +++ b/pandatool/src/progbase/wordWrapStreamBuf.cxx @@ -42,7 +42,7 @@ WordWrapStreamBuf:: */ int WordWrapStreamBuf:: sync() { - streamsize n = pptr() - pbase(); + std::streamsize n = pptr() - pbase(); write_chars(pbase(), n); // Send all the data out now. @@ -57,7 +57,7 @@ sync() { */ int WordWrapStreamBuf:: overflow(int ch) { - streamsize n = pptr() - pbase(); + std::streamsize n = pptr() - pbase(); if (n != 0 && sync() != 0) { return EOF; @@ -81,10 +81,10 @@ void WordWrapStreamBuf:: write_chars(const char *start, int length) { if (length > 0) { set_literal_mode((_owner->flags() & Notify::get_literal_flag()) != 0); - string new_data(start, length); + std::string new_data(start, length); size_t newline = new_data.find_first_of("\n\r"); size_t p = 0; - while (newline != string::npos) { + while (newline != std::string::npos) { // The new data contains a newline; flush our data to that point. _data += new_data.substr(p, newline - p + 1); flush_data(); @@ -105,7 +105,7 @@ void WordWrapStreamBuf:: flush_data() { if (!_data.empty()) { if (_literal_mode) { - cerr << _data; + std::cerr << _data; } else { _program->show_text(_data); } diff --git a/pandatool/src/pstatserver/pStatClientData.cxx b/pandatool/src/pstatserver/pStatClientData.cxx index 77136b7f1d..26e06f069c 100644 --- a/pandatool/src/pstatserver/pStatClientData.cxx +++ b/pandatool/src/pstatserver/pStatClientData.cxx @@ -16,6 +16,8 @@ #include "pStatCollectorDef.h" +using std::string; + PStatCollectorDef PStatClientData::_null_collector(-1, "Unknown"); diff --git a/pandatool/src/pstatserver/pStatGraph.cxx b/pandatool/src/pstatserver/pStatGraph.cxx index f65dafbc3b..88130ff7ab 100644 --- a/pandatool/src/pstatserver/pStatGraph.cxx +++ b/pandatool/src/pstatserver/pStatGraph.cxx @@ -20,6 +20,8 @@ #include // for sprintf +using std::string; + /** * */ diff --git a/pandatool/src/pstatserver/pStatMonitor.cxx b/pandatool/src/pstatserver/pStatMonitor.cxx index f7e70727fe..09e22b093a 100644 --- a/pandatool/src/pstatserver/pStatMonitor.cxx +++ b/pandatool/src/pstatserver/pStatMonitor.cxx @@ -15,6 +15,8 @@ #include "pStatCollectorDef.h" +using std::string; + /** * diff --git a/pandatool/src/pstatserver/pStatReader.cxx b/pandatool/src/pstatserver/pStatReader.cxx index c302185e0f..02b01f26a2 100644 --- a/pandatool/src/pstatserver/pStatReader.cxx +++ b/pandatool/src/pstatserver/pStatReader.cxx @@ -123,7 +123,7 @@ get_monitor() { /** * Returns the current machine's hostname. */ -string PStatReader:: +std::string PStatReader:: get_hostname() { if (_hostname.empty()) { _hostname = ConnectionManager::get_host_name(); @@ -217,7 +217,7 @@ handle_client_control_message(const PStatClientControlMessage &message) { { for (int i = 0; i < (int)message._names.size(); i++) { int thread_index = message._first_thread_index + i; - string name = message._names[i]; + std::string name = message._names[i]; _client_data->define_thread(thread_index, name); _monitor->new_thread(thread_index); } diff --git a/pandatool/src/pstatserver/pStatStripChart.cxx b/pandatool/src/pstatserver/pStatStripChart.cxx index 9b64abaa02..c9ffcb3109 100644 --- a/pandatool/src/pstatserver/pStatStripChart.cxx +++ b/pandatool/src/pstatserver/pStatStripChart.cxx @@ -22,6 +22,9 @@ #include +using std::max; +using std::min; + /** * */ @@ -248,9 +251,9 @@ get_collector_under_pixel(int xpoint, int ypoint) { /** * Returns the text suitable for the title label on the top line. */ -string PStatStripChart:: +std::string PStatStripChart:: get_title_text() { - string text; + std::string text; _title_unknown = false; diff --git a/pandatool/src/ptloader/loaderFileTypePandatool.cxx b/pandatool/src/ptloader/loaderFileTypePandatool.cxx index dade132585..769eb737d0 100644 --- a/pandatool/src/ptloader/loaderFileTypePandatool.cxx +++ b/pandatool/src/ptloader/loaderFileTypePandatool.cxx @@ -47,7 +47,7 @@ LoaderFileTypePandatool:: /** * */ -string LoaderFileTypePandatool:: +std::string LoaderFileTypePandatool:: get_name() const { if (_loader != nullptr) { return _loader->get_name(); @@ -58,7 +58,7 @@ get_name() const { /** * */ -string LoaderFileTypePandatool:: +std::string LoaderFileTypePandatool:: get_extension() const { if (_loader != nullptr) { return _loader->get_extension(); @@ -70,7 +70,7 @@ get_extension() const { * Returns a space-separated list of extension, in addition to the one * returned by get_extension(), that are recognized by this converter. */ -string LoaderFileTypePandatool:: +std::string LoaderFileTypePandatool:: get_additional_extensions() const { if (_loader != nullptr) { return _loader->get_additional_extensions(); diff --git a/pandatool/src/softegg/softNodeDesc.cxx b/pandatool/src/softegg/softNodeDesc.cxx index 86d98ab7db..ff0f624a20 100644 --- a/pandatool/src/softegg/softNodeDesc.cxx +++ b/pandatool/src/softegg/softNodeDesc.cxx @@ -19,13 +19,15 @@ #include "softToEggConverter.h" #include "dcast.h" +using std::endl; + TypeHandle SoftNodeDesc::_type_handle; /** * */ SoftNodeDesc:: -SoftNodeDesc(SoftNodeDesc *parent, const string &name) : +SoftNodeDesc(SoftNodeDesc *parent, const std::string &name) : Namable(name), _parent(parent) { @@ -901,7 +903,7 @@ make_vertex_offsets(int numShapes) { SAA_Scene *scene = &stec.scene; EggVertexPool *vpool = nullptr; - string vpool_name = get_name() + ".verts"; + std::string vpool_name = get_name() + ".verts"; EggNode *t = stec._tree.get_egg_root()->find_child(vpool_name); if (t) DCAST_INTO_V(vpool, t); diff --git a/pandatool/src/softegg/softNodeTree.cxx b/pandatool/src/softegg/softNodeTree.cxx index a896bce4e0..3b5be3252b 100644 --- a/pandatool/src/softegg/softNodeTree.cxx +++ b/pandatool/src/softegg/softNodeTree.cxx @@ -25,6 +25,8 @@ #include +using std::endl; + /** * */ @@ -288,7 +290,7 @@ get_node(int n) const { * Returns the node named 'name' in the hierarchy, in an arbitrary ordering. */ SoftNodeDesc *SoftNodeTree:: -get_node(string name) const { +get_node(std::string name) const { NodesByName::const_iterator ni = _nodes_by_name.find(name); if (ni != _nodes_by_name.end()) return (*ni).second; @@ -451,7 +453,7 @@ handle_null(SAA_Scene *scene, SoftNodeDesc *node_desc, const char *node_name) { SoftNodeDesc *SoftNodeTree:: build_node(SAA_Scene *scene, SAA_Elem *model) { char *name, *fullname; - string node_name; + std::string node_name; int numChildren; int thisChild; SAA_Elem *children; @@ -533,7 +535,7 @@ build_node(SAA_Scene *scene, SAA_Elem *model) { * The recursive implementation of build_node(). */ SoftNodeDesc *SoftNodeTree:: -r_build_node(SoftNodeDesc *parent_node, const string &name) { +r_build_node(SoftNodeDesc *parent_node, const std::string &name) { SoftNodeDesc *node_desc; // If we have already encountered this pathname, return the corresponding diff --git a/pandatool/src/softegg/softToEggConverter.cxx b/pandatool/src/softegg/softToEggConverter.cxx index 3e0ab21ef6..44dafefb62 100644 --- a/pandatool/src/softegg/softToEggConverter.cxx +++ b/pandatool/src/softegg/softToEggConverter.cxx @@ -32,6 +32,9 @@ #include "string_utils.h" #include "dcast.h" +using std::endl; +using std::string; + SoftToEggConverter stec; const int TEX_PER_MAT = 1; diff --git a/pandatool/src/softprogs/softCVS.cxx b/pandatool/src/softprogs/softCVS.cxx index a0351b854e..478aa682d2 100644 --- a/pandatool/src/softprogs/softCVS.cxx +++ b/pandatool/src/softprogs/softCVS.cxx @@ -18,6 +18,8 @@ #include +using std::string; + /** * */ @@ -472,7 +474,7 @@ scan_cvs(const string &dirname, pset &cvs_elements) { * reference found, increments the appropriate element file's reference count. */ bool SoftCVS:: -scan_scene_file(istream &in, Multifile &multifile) { +scan_scene_file(std::istream &in, Multifile &multifile) { bool okflag = true; int c = in.get(); @@ -493,7 +495,7 @@ scan_scene_file(istream &in, Multifile &multifile) { SoftFilename v("", word); // Increment the use count on all matching elements of the multiset. - pair range; + std::pair range; range = _element_files.equal_range(v); ElementFiles::iterator ei; diff --git a/pandatool/src/softprogs/softFilename.cxx b/pandatool/src/softprogs/softFilename.cxx index 16d69de675..4c099c56be 100644 --- a/pandatool/src/softprogs/softFilename.cxx +++ b/pandatool/src/softprogs/softFilename.cxx @@ -15,6 +15,8 @@ #include "pnotify.h" +using std::string; + /** * */ diff --git a/pandatool/src/text-stats/textMonitor.cxx b/pandatool/src/text-stats/textMonitor.cxx index 69b134cc8f..2f4f458387 100644 --- a/pandatool/src/text-stats/textMonitor.cxx +++ b/pandatool/src/text-stats/textMonitor.cxx @@ -22,7 +22,7 @@ * */ TextMonitor:: -TextMonitor(TextStats *server, ostream *outStream, bool show_raw_data ) : PStatMonitor(server) { +TextMonitor(TextStats *server, std::ostream *outStream, bool show_raw_data ) : PStatMonitor(server) { _outStream = outStream; //[PECI] _show_raw_data = show_raw_data; } @@ -39,7 +39,7 @@ get_server() { * Should be redefined to return a descriptive name for the type of * PStatsMonitor this is. */ -string TextMonitor:: +std::string TextMonitor:: get_monitor_name() { return "Text Stats"; } diff --git a/pandatool/src/vrml/parse_vrml.cxx b/pandatool/src/vrml/parse_vrml.cxx index 1e55b68594..9ec700f19a 100644 --- a/pandatool/src/vrml/parse_vrml.cxx +++ b/pandatool/src/vrml/parse_vrml.cxx @@ -30,6 +30,10 @@ #include "zStream.h" #include "virtualFileSystem.h" +using std::istream; +using std::istringstream; +using std::string; + extern int vrmlyyparse(); extern void vrmlyyResetLineNumber(); extern int vrmlyydebug; @@ -99,7 +103,7 @@ parse_vrml(Filename filename) { VrmlScene * parse_vrml(istream &in, const string &filename) { if (!get_standard_nodes()) { - cerr << "Internal error--unable to parse VRML.\n"; + std::cerr << "Internal error--unable to parse VRML.\n"; return nullptr; } @@ -121,7 +125,7 @@ parse_vrml(istream &in, const string &filename) { int main(int argc, char *argv[]) { if (argc < 2) { - cerr << "parse_vrml filename.wrl\n"; + std::cerr << "parse_vrml filename.wrl\n"; exit(1); } @@ -130,7 +134,7 @@ main(int argc, char *argv[]) { exit(1); } - cout << *scene << "\n"; + std::cout << *scene << "\n"; return (0); } #endif diff --git a/pandatool/src/vrml/vrmlLexer.cxx.prebuilt b/pandatool/src/vrml/vrmlLexer.cxx.prebuilt index 87565a5ea2..cc79d45379 100644 --- a/pandatool/src/vrml/vrmlLexer.cxx.prebuilt +++ b/pandatool/src/vrml/vrmlLexer.cxx.prebuilt @@ -2723,21 +2723,18 @@ int vrmlyy_flex_debug = 0; #define YY_RESTORE_YY_MORE_OFFSET char *vrmlyytext; #line 1 "vrmlLexer.lxx" -/* -// Filename: vrmlLexer.lxx -// Created by: drose (01Oct04) -// -//////////////////////////////////////////////////////////////////// -// -// PANDA 3D SOFTWARE -// Copyright (c) Carnegie Mellon University. All rights reserved. -// -// All use of this software is subject to the terms of the revised BSD -// license. You should have received a copy of this license along -// with this source code in a file named "LICENSE." -// -//////////////////////////////////////////////////////////////////// -*/ +/** + * PANDA 3D SOFTWARE + * Copyright (c) Carnegie Mellon University. All rights reserved. + * + * All use of this software is subject to the terms of the revised BSD + * license. You should have received a copy of this license along + * with this source code in a file named "LICENSE." + * + * @file vrmlLexer.lxx + * @author drose + * @date 2004-10-01 + */ /************************************************** * VRML 2.0 Parser * Copyright (C) 1996 Silicon Graphics, Inc. @@ -2774,13 +2771,13 @@ 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 vrml file we're parsing. We keep it so we // can print it out for error messages. -static string vrml_filename; +static std::string vrml_filename; -extern void vrmlyyerror(const string &); +extern void vrmlyyerror(const std::string &); /* The YACC parser sets this to a token to direct the lexer */ /* in cases where just syntax isn't enough: */ @@ -2794,13 +2791,13 @@ static int sfImageIntsParsed = 0; static int sfImageIntsExpected = 0; // This is used while scanning a quoted string. -static string quoted_string; +static std::string quoted_string; // And this keeps track of the currently-parsing array. static MFArray *mfarray; void -vrml_init_lexer(istream &in, const string &filename) { +vrml_init_lexer(std::istream &in, const std::string &filename) { input_p = ∈ vrml_filename = filename; line_number = 0; @@ -2818,7 +2815,9 @@ vrmlyywrap(void) { } void -vrmlyyerror(const string &msg) { +vrmlyyerror(const std::string &msg) { + using std::cerr; + cerr << "\nError"; if (!vrml_filename.empty()) { cerr << " in " << vrml_filename; @@ -2831,7 +2830,9 @@ vrmlyyerror(const string &msg) { } void -vrmlyywarning(const string &msg) { +vrmlyywarning(const std::string &msg) { + using std::cerr; + cerr << "\nWarning"; if (!vrml_filename.empty()) { cerr << " in " << vrml_filename; diff --git a/pandatool/src/vrml/vrmlLexer.lxx b/pandatool/src/vrml/vrmlLexer.lxx index cd913fddc1..fb16b30c40 100644 --- a/pandatool/src/vrml/vrmlLexer.lxx +++ b/pandatool/src/vrml/vrmlLexer.lxx @@ -1,18 +1,15 @@ -/* -// Filename: vrmlLexer.lxx -// Created by: drose (01Oct04) -// -//////////////////////////////////////////////////////////////////// -// -// PANDA 3D SOFTWARE -// Copyright (c) Carnegie Mellon University. All rights reserved. -// -// All use of this software is subject to the terms of the revised BSD -// license. You should have received a copy of this license along -// with this source code in a file named "LICENSE." -// -//////////////////////////////////////////////////////////////////// -*/ +/** + * PANDA 3D SOFTWARE + * Copyright (c) Carnegie Mellon University. All rights reserved. + * + * All use of this software is subject to the terms of the revised BSD + * license. You should have received a copy of this license along + * with this source code in a file named "LICENSE." + * + * @file vrmlLexer.lxx + * @author drose + * @date 2004-10-01 + */ /************************************************** * VRML 2.0 Parser @@ -50,13 +47,13 @@ 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 vrml file we're parsing. We keep it so we // can print it out for error messages. -static string vrml_filename; +static std::string vrml_filename; -extern void vrmlyyerror(const string &); +extern void vrmlyyerror(const std::string &); /* The YACC parser sets this to a token to direct the lexer */ /* in cases where just syntax isn't enough: */ @@ -70,13 +67,13 @@ static int sfImageIntsParsed = 0; static int sfImageIntsExpected = 0; // This is used while scanning a quoted string. -static string quoted_string; +static std::string quoted_string; // And this keeps track of the currently-parsing array. static MFArray *mfarray; void -vrml_init_lexer(istream &in, const string &filename) { +vrml_init_lexer(std::istream &in, const std::string &filename) { input_p = ∈ vrml_filename = filename; line_number = 0; @@ -94,7 +91,9 @@ vrmlyywrap(void) { } void -vrmlyyerror(const string &msg) { +vrmlyyerror(const std::string &msg) { + using std::cerr; + cerr << "\nError"; if (!vrml_filename.empty()) { cerr << " in " << vrml_filename; @@ -107,7 +106,9 @@ vrmlyyerror(const string &msg) { } void -vrmlyywarning(const string &msg) { +vrmlyywarning(const std::string &msg) { + using std::cerr; + cerr << "\nWarning"; if (!vrml_filename.empty()) { cerr << " in " << vrml_filename; diff --git a/pandatool/src/vrml/vrmlNode.cxx b/pandatool/src/vrml/vrmlNode.cxx index 628e09fb31..c48ce35e4a 100644 --- a/pandatool/src/vrml/vrmlNode.cxx +++ b/pandatool/src/vrml/vrmlNode.cxx @@ -43,7 +43,7 @@ get_value(const char *field_name) const { return field->dflt; } - cerr << "No such field defined for type " << _type->getName() << ": " + std::cerr << "No such field defined for type " << _type->getName() << ": " << field_name << "\n"; exit(1); // Just to make the compiler happy. @@ -52,7 +52,7 @@ get_value(const char *field_name) const { } void VrmlNode:: -output(ostream &out, int indent_level) const { +output(std::ostream &out, int indent_level) const { out << _type->getName() << " {\n"; Fields::const_iterator fi; for (fi = _fields.begin(); fi != _fields.end(); ++fi) { @@ -64,13 +64,13 @@ output(ostream &out, int indent_level) const { void Declaration:: -output(ostream &out, int indent) const { +output(std::ostream &out, int indent) const { VrmlFieldValue v; v._sfnode = _node; output_value(out, v, SFNODE, indent); } -ostream &operator << (ostream &out, const VrmlScene &scene) { +std::ostream &operator << (std::ostream &out, const VrmlScene &scene) { VrmlScene::const_iterator si; for (si = scene.begin(); si != scene.end(); ++si) { out << (*si) << "\n"; diff --git a/pandatool/src/vrml/vrmlNodeType.cxx b/pandatool/src/vrml/vrmlNodeType.cxx index 923570bd81..56652507b5 100644 --- a/pandatool/src/vrml/vrmlNodeType.cxx +++ b/pandatool/src/vrml/vrmlNodeType.cxx @@ -20,6 +20,8 @@ #include // for sprintf() +using std::ostream; + // // Static list of node types. @@ -177,8 +179,8 @@ void VrmlNodeType::addToNameSpace(VrmlNodeType *_type) { if (find(_type->getName()) != nullptr) { - cerr << "PROTO " << _type->getName() << " already defined\n"; - return; + std::cerr << "PROTO " << _type->getName() << " already defined\n"; + return; } typeList.push_front(_type); } diff --git a/pandatool/src/vrml/vrmlParser.cxx.prebuilt b/pandatool/src/vrml/vrmlParser.cxx.prebuilt index 6eaddbf170..b94bc8d5ae 100644 --- a/pandatool/src/vrml/vrmlParser.cxx.prebuilt +++ b/pandatool/src/vrml/vrmlParser.cxx.prebuilt @@ -151,14 +151,14 @@ void storeField(const VrmlFieldValue &value); void exitField(); void expect(int type); -extern void vrmlyyerror(const string &); +extern void vrmlyyerror(const std::string &); //////////////////////////////////////////////////////////////////// // Defining the interface to the parser. //////////////////////////////////////////////////////////////////// void -vrml_init_parser(istream &in, const string &filename) { +vrml_init_parser(std::istream &in, const std::string &filename) { //yydebug = 0; vrml_init_lexer(in, filename); } @@ -2189,7 +2189,7 @@ endProto() // Add this proto definition: if (currentProtoStack.empty()) { - cerr << "Error: Empty PROTO stack!\n"; + std::cerr << "Error: Empty PROTO stack!\n"; } else { VrmlNodeType *t = currentProtoStack.top(); @@ -2232,14 +2232,14 @@ add(void (VrmlNodeType::*func)(const char *, int, const VrmlFieldValue *), int type = fieldType(typeString); if (type == 0) { - cerr << "Error: invalid field type: " << type << "\n"; + std::cerr << "Error: invalid field type: " << type << "\n"; } // Need to add support for Script nodes: // if (inScript) ... ??? if (currentProtoStack.empty()) { - cerr << "Error: declaration outside of prototype\n"; + std::cerr << "Error: declaration outside of prototype\n"; return 0; } VrmlNodeType *t = currentProtoStack.top(); @@ -2271,7 +2271,7 @@ fieldType(const char *type) if (strcmp(type, "MFVec2f") == 0) return MFVEC2F; if (strcmp(type, "MFVec3f") == 0) return MFVEC3F; - cerr << "Illegal field type: " << type << "\n"; + std::cerr << "Illegal field type: " << type << "\n"; return 0; } @@ -2306,7 +2306,7 @@ exitNode() nassertr(node != NULL, NULL); currentNode.pop(); - // cerr << "Just defined node:\n" << *node << "\n\n"; + // std::cerr << "Just defined node:\n" << *node << "\n\n"; delete fr; return node; @@ -2346,7 +2346,7 @@ enterField(const char *fieldName) expect(typeRec->type); } else { - cerr << "Error: Nodes of type " << fr->nodeType->getName() << + std::cerr << "Error: Nodes of type " << fr->nodeType->getName() << " do not have fields/eventIn/eventOut named " << fieldName << "\n"; // expect(ANY_FIELD); diff --git a/pandatool/src/vrml/vrmlParser.yxx b/pandatool/src/vrml/vrmlParser.yxx index d114028828..9bbdda7bf6 100644 --- a/pandatool/src/vrml/vrmlParser.yxx +++ b/pandatool/src/vrml/vrmlParser.yxx @@ -94,14 +94,14 @@ void storeField(const VrmlFieldValue &value); void exitField(); void expect(int type); -extern void vrmlyyerror(const string &); +extern void vrmlyyerror(const std::string &); //////////////////////////////////////////////////////////////////// // Defining the interface to the parser. //////////////////////////////////////////////////////////////////// void -vrml_init_parser(istream &in, const string &filename) { +vrml_init_parser(std::istream &in, const std::string &filename) { //yydebug = 0; vrml_init_lexer(in, filename); } @@ -132,7 +132,7 @@ vrml_cleanup_parser() { * %type vrmlscene declarations */ -%token IDENTIFIER +%token IDENTIFIER %token DEF USE PROTO EXTERNPROTO TO IS ROUTE SFN_NULL %token EVENTIN EVENTOUT FIELD EXPOSEDFIELD @@ -370,7 +370,7 @@ endProto() // Add this proto definition: if (currentProtoStack.empty()) { - cerr << "Error: Empty PROTO stack!\n"; + std::cerr << "Error: Empty PROTO stack!\n"; } else { VrmlNodeType *t = currentProtoStack.top(); @@ -413,14 +413,14 @@ add(void (VrmlNodeType::*func)(const char *, int, const VrmlFieldValue *), int type = fieldType(typeString); if (type == 0) { - cerr << "Error: invalid field type: " << type << "\n"; + std::cerr << "Error: invalid field type: " << type << "\n"; } // Need to add support for Script nodes: // if (inScript) ... ??? if (currentProtoStack.empty()) { - cerr << "Error: declaration outside of prototype\n"; + std::cerr << "Error: declaration outside of prototype\n"; return 0; } VrmlNodeType *t = currentProtoStack.top(); @@ -452,7 +452,7 @@ fieldType(const char *type) if (strcmp(type, "MFVec2f") == 0) return MFVEC2F; if (strcmp(type, "MFVec3f") == 0) return MFVEC3F; - cerr << "Illegal field type: " << type << "\n"; + std::cerr << "Illegal field type: " << type << "\n"; return 0; } @@ -487,7 +487,7 @@ exitNode() nassertr(node != nullptr, nullptr); currentNode.pop(); - // cerr << "Just defined node:\n" << *node << "\n\n"; + // std::cerr << "Just defined node:\n" << *node << "\n\n"; delete fr; return node; @@ -527,7 +527,7 @@ enterField(const char *fieldName) expect(typeRec->type); } else { - cerr << "Error: Nodes of type " << fr->nodeType->getName() << + std::cerr << "Error: Nodes of type " << fr->nodeType->getName() << " do not have fields/eventIn/eventOut named " << fieldName << "\n"; // expect(ANY_FIELD); diff --git a/pandatool/src/vrmlegg/indexedFaceSet.cxx b/pandatool/src/vrmlegg/indexedFaceSet.cxx index 35e03857fc..0f0dce8e68 100644 --- a/pandatool/src/vrmlegg/indexedFaceSet.cxx +++ b/pandatool/src/vrmlegg/indexedFaceSet.cxx @@ -22,6 +22,8 @@ #include "eggVertexPool.h" #include "eggPolygon.h" +using std::cerr; + /** * */ diff --git a/pandatool/src/vrmlegg/vrmlToEggConverter.cxx b/pandatool/src/vrmlegg/vrmlToEggConverter.cxx index 150cf6da4c..d308e34714 100644 --- a/pandatool/src/vrmlegg/vrmlToEggConverter.cxx +++ b/pandatool/src/vrmlegg/vrmlToEggConverter.cxx @@ -57,7 +57,7 @@ make_copy() { /** * Returns the English name of the file type this converter supports. */ -string VRMLToEggConverter:: +std::string VRMLToEggConverter:: get_name() const { return "VRML"; } @@ -65,7 +65,7 @@ get_name() const { /** * Returns the common extension of the file type this converter supports. */ -string VRMLToEggConverter:: +std::string VRMLToEggConverter:: get_extension() const { return "wrl"; } @@ -145,7 +145,7 @@ get_all_defs(SFNodeRef &vrml, VRMLToEggConverter::Nodes &nodes) { nassertv(vrml._name != nullptr); ni = nodes.find(vrml._name); if (ni == nodes.end()) { - cerr << "Unknown node reference: " << vrml._name << "\n"; + std::cerr << "Unknown node reference: " << vrml._name << "\n"; } else { // Increment the use count of the node. (*ni).second->_use_count++; @@ -214,7 +214,7 @@ vrml_grouping_node(const SFNodeRef &vrml, EggGroupNode *egg, const LMatrix4d &net_transform)) { const VrmlNode *node = vrml._p; nassertv(node != nullptr); - string name; + std::string name; if (vrml._name != nullptr) { name = vrml._name; } @@ -376,7 +376,7 @@ vrml_shape(const VrmlNode *node, EggGroup *group, IndexedFaceSet ifs(geometry, appearance); ifs.convert_to_egg(group, net_transform); } else { - cerr << "Ignoring " << geometry->_type->getName() << "\n"; + std::cerr << "Ignoring " << geometry->_type->getName() << "\n"; } } } diff --git a/pandatool/src/win-stats/winStats.cxx b/pandatool/src/win-stats/winStats.cxx index 0b22e9e0d7..7818ea5ed8 100644 --- a/pandatool/src/win-stats/winStats.cxx +++ b/pandatool/src/win-stats/winStats.cxx @@ -62,9 +62,9 @@ create_toplevel_window(HINSTANCE application) { DWORD window_style = WS_POPUP | WS_SYSMENU | WS_ICONIC; - ostringstream strm; + std::ostringstream strm; strm << "PStats " << pstats_port; - string window_name = strm.str(); + std::string window_name = strm.str(); HWND toplevel_window = CreateWindow(toplevel_class_name, window_name.c_str(), window_style, @@ -87,12 +87,12 @@ int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) { // Create the server object. server = new WinStatsServer; if (!server->listen()) { - ostringstream stream; + std::ostringstream stream; stream << "Unable to open port " << pstats_port << ". Try specifying a different\n" << "port number using pstats-port in your Config file."; - string str = stream.str(); + std::string str = stream.str(); MessageBox(toplevel_window, str.c_str(), "PStats error", MB_OK | MB_ICONEXCLAMATION); exit(1); diff --git a/pandatool/src/win-stats/winStatsChartMenu.cxx b/pandatool/src/win-stats/winStatsChartMenu.cxx index faeb59d874..c042acf8ba 100644 --- a/pandatool/src/win-stats/winStatsChartMenu.cxx +++ b/pandatool/src/win-stats/winStatsChartMenu.cxx @@ -47,7 +47,7 @@ get_menu_handle() { void WinStatsChartMenu:: add_to_menu_bar(HMENU menu_bar, int before_menu_id) { const PStatClientData *client_data = _monitor->get_client_data(); - string thread_name; + std::string thread_name; if (_thread_index == 0) { // A special case for the main thread. thread_name = "Graphs"; @@ -149,7 +149,7 @@ add_view(HMENU parent_menu, const PStatViewLevel *view_level, bool show_level) { int collector = view_level->get_collector(); const PStatClientData *client_data = _monitor->get_client_data(); - string collector_name = client_data->get_collector_name(collector); + std::string collector_name = client_data->get_collector_name(collector); WinStatsMonitor::MenuDef menu_def(_thread_index, collector, show_level); int menu_id = _monitor->get_menu_id(menu_def); @@ -169,7 +169,7 @@ add_view(HMENU parent_menu, const PStatViewLevel *view_level, bool show_level) { // If the collector has more than one child, add a menu entry to go // directly to each of its children. HMENU submenu = CreatePopupMenu(); - string submenu_name = collector_name + " components"; + std::string submenu_name = collector_name + " components"; mii.fMask = MIIM_STRING | MIIM_FTYPE | MIIM_SUBMENU; mii.fType = MFT_STRING; diff --git a/pandatool/src/win-stats/winStatsGraph.cxx b/pandatool/src/win-stats/winStatsGraph.cxx index 6eb19583f6..4946bbc671 100644 --- a/pandatool/src/win-stats/winStatsGraph.cxx +++ b/pandatool/src/win-stats/winStatsGraph.cxx @@ -467,8 +467,8 @@ move_graph_window(int graph_left, int graph_top, int graph_xsize, int graph_ysiz void WinStatsGraph:: setup_bitmap(int xsize, int ysize) { release_bitmap(); - _bitmap_xsize = max(xsize, 0); - _bitmap_ysize = max(ysize, 0); + _bitmap_xsize = std::max(xsize, 0); + _bitmap_ysize = std::max(ysize, 0); HDC hdc = GetDC(_graph_window); _bitmap_dc = CreateCompatibleDC(hdc); @@ -508,7 +508,7 @@ create_graph_window() { HINSTANCE application = GetModuleHandle(nullptr); register_graph_window_class(application); - string window_title = "graph"; + std::string window_title = "graph"; DWORD window_style = WS_CHILD | WS_CLIPSIBLINGS; _graph_window = diff --git a/pandatool/src/win-stats/winStatsLabelStack.cxx b/pandatool/src/win-stats/winStatsLabelStack.cxx index 063a7780e8..af3bcccd00 100644 --- a/pandatool/src/win-stats/winStatsLabelStack.cxx +++ b/pandatool/src/win-stats/winStatsLabelStack.cxx @@ -61,7 +61,7 @@ setup(HWND parent_window) { for (li = _labels.begin(); li != _labels.end(); ++li) { WinStatsLabel *label = (*li); label->setup(_window); - _ideal_width = max(_ideal_width, label->get_ideal_width()); + _ideal_width = std::max(_ideal_width, label->get_ideal_width()); } } @@ -192,7 +192,7 @@ add_label(WinStatsMonitor *monitor, WinStatsGraph *graph, label->setup(_window); label->set_pos(0, yp, _width); } - _ideal_width = max(_ideal_width, label->get_ideal_width()); + _ideal_width = std::max(_ideal_width, label->get_ideal_width()); int label_index = (int)_labels.size(); _labels.push_back(label); diff --git a/pandatool/src/win-stats/winStatsMonitor.cxx b/pandatool/src/win-stats/winStatsMonitor.cxx index 1b2cedee37..50c66362d1 100644 --- a/pandatool/src/win-stats/winStatsMonitor.cxx +++ b/pandatool/src/win-stats/winStatsMonitor.cxx @@ -71,7 +71,7 @@ WinStatsMonitor:: * Should be redefined to return a descriptive name for the type of * PStatsMonitor this is. */ -string WinStatsMonitor:: +std::string WinStatsMonitor:: get_monitor_name() { return "WinStats"; } @@ -107,7 +107,7 @@ got_hello() { void WinStatsMonitor:: got_bad_version(int client_major, int client_minor, int server_major, int server_minor) { - ostringstream str; + std::ostringstream str; str << "Unable to honor connection attempt from " << get_client_progname() << " on " << get_client_hostname() << ": unsupported PStats version " @@ -121,7 +121,7 @@ got_bad_version(int client_major, int client_minor, << ".0 through " << server_major << "." << server_minor << ")."; } - string message = str.str(); + std::string message = str.str(); MessageBox(nullptr, message.c_str(), "Bad version", MB_OK | MB_ICONINFORMATION | MB_SETFOREGROUND); } diff --git a/pandatool/src/win-stats/winStatsPianoRoll.cxx b/pandatool/src/win-stats/winStatsPianoRoll.cxx index 7c81b65fdf..859de11b68 100644 --- a/pandatool/src/win-stats/winStatsPianoRoll.cxx +++ b/pandatool/src/win-stats/winStatsPianoRoll.cxx @@ -468,7 +468,7 @@ draw_guide_label(HDC hdc, int y, const PStatGraph::GuideBar &bar) { } int x = height_to_pixel(bar._height); - const string &label = bar._label; + const std::string &label = bar._label; SIZE size; GetTextExtentPoint32(hdc, label.data(), label.length(), &size); @@ -502,8 +502,8 @@ create_window() { const PStatClientData *client_data = WinStatsGraph::_monitor->get_client_data(); - string thread_name = client_data->get_thread_name(_thread_index); - string window_title = thread_name + " thread piano roll"; + std::string thread_name = client_data->get_thread_name(_thread_index); + std::string window_title = thread_name + " thread piano roll"; RECT win_rect = { diff --git a/pandatool/src/win-stats/winStatsStripChart.cxx b/pandatool/src/win-stats/winStatsStripChart.cxx index 79411a03d7..879b920673 100644 --- a/pandatool/src/win-stats/winStatsStripChart.cxx +++ b/pandatool/src/win-stats/winStatsStripChart.cxx @@ -16,6 +16,8 @@ #include "pStatCollectorDef.h" #include "numeric_types.h" +using std::string; + static const int default_strip_chart_width = 400; static const int default_strip_chart_height = 100; diff --git a/pandatool/src/xfile/windowsGuid.cxx b/pandatool/src/xfile/windowsGuid.cxx index 101e2b98cf..fbe649673c 100644 --- a/pandatool/src/xfile/windowsGuid.cxx +++ b/pandatool/src/xfile/windowsGuid.cxx @@ -16,6 +16,8 @@ #include // for sscanf, sprintf +using std::string; + /** * Parses the hex representation in the indicated string and stores it in the * WindowsGuid object. Returns true if successful, false if the string @@ -69,6 +71,6 @@ format_string() const { * Outputs a hex representation of the GUID. */ void WindowsGuid:: -output(ostream &out) const { +output(std::ostream &out) const { out << format_string(); } diff --git a/pandatool/src/xfile/xFile.cxx b/pandatool/src/xfile/xFile.cxx index 17fc9f1e34..c5534e0af1 100644 --- a/pandatool/src/xfile/xFile.cxx +++ b/pandatool/src/xfile/xFile.cxx @@ -22,6 +22,11 @@ #include "virtualFileSystem.h" #include "dcast.h" +using std::istream; +using std::istringstream; +using std::ostream; +using std::string; + TypeHandle XFile::_type_handle; PT(XFile) XFile::_standard_templates; diff --git a/pandatool/src/xfile/xFileArrayDef.cxx b/pandatool/src/xfile/xFileArrayDef.cxx index da5abf9f51..91078f5576 100644 --- a/pandatool/src/xfile/xFileArrayDef.cxx +++ b/pandatool/src/xfile/xFileArrayDef.cxx @@ -38,7 +38,7 @@ get_size(const XFileNode::PrevData &prev_data) const { * */ void XFileArrayDef:: -output(ostream &out) const { +output(std::ostream &out) const { if (is_fixed_size()) { out << "[" << _fixed_size << "]"; } else { diff --git a/pandatool/src/xfile/xFileDataDef.cxx b/pandatool/src/xfile/xFileDataDef.cxx index 6c133347ef..2a35528768 100644 --- a/pandatool/src/xfile/xFileDataDef.cxx +++ b/pandatool/src/xfile/xFileDataDef.cxx @@ -53,7 +53,7 @@ add_array_def(const XFileArrayDef &array_def) { * Writes a suitable representation of this node to an .x file in text mode. */ void XFileDataDef:: -write_text(ostream &out, int indent_level) const { +write_text(std::ostream &out, int indent_level) const { indent(out, indent_level); if (!_array_def.empty()) { @@ -405,7 +405,7 @@ unpack_value(const XFileParseDataList &parse_data_list, int array_index, for (int i = 0; i < array_size; i++) { if (index >= parse_data_list._list.size()) { - xyyerror(string("Expected ") + format_string(array_size) + xyyerror(std::string("Expected ") + format_string(array_size) + " array elements, found " + format_string(i)); return data_value; } diff --git a/pandatool/src/xfile/xFileDataNode.cxx b/pandatool/src/xfile/xFileDataNode.cxx index d0ebb6dba8..bc1326697e 100644 --- a/pandatool/src/xfile/xFileDataNode.cxx +++ b/pandatool/src/xfile/xFileDataNode.cxx @@ -20,7 +20,7 @@ TypeHandle XFileDataNode::_type_handle; * */ XFileDataNode:: -XFileDataNode(XFile *x_file, const string &name, +XFileDataNode(XFile *x_file, const std::string &name, XFileTemplate *xtemplate) : XFileNode(x_file, name), _template(xtemplate) @@ -46,7 +46,7 @@ is_object() const { * object must be of type XFileDataNode. */ bool XFileDataNode:: -is_standard_object(const string &template_name) const { +is_standard_object(const std::string &template_name) const { if (_template->is_standard() && _template->get_name() == template_name) { return true; @@ -59,7 +59,7 @@ is_standard_object(const string &template_name) const { * Returns a string that represents the type of object this data object * represents. */ -string XFileDataNode:: +std::string XFileDataNode:: get_type_name() const { return _template->get_name(); } diff --git a/pandatool/src/xfile/xFileDataNodeReference.cxx b/pandatool/src/xfile/xFileDataNodeReference.cxx index 157acdbba6..7796aeeeda 100644 --- a/pandatool/src/xfile/xFileDataNodeReference.cxx +++ b/pandatool/src/xfile/xFileDataNodeReference.cxx @@ -62,7 +62,7 @@ is_complex_object() const { * Writes a suitable representation of this node to an .x file in text mode. */ void XFileDataNodeReference:: -write_text(ostream &out, int indent_level) const { +write_text(std::ostream &out, int indent_level) const { indent(out, indent_level) << "{ " << _object->get_name() << " }\n"; } @@ -89,6 +89,6 @@ get_element(int n) { * name. */ XFileDataObject *XFileDataNodeReference:: -get_element(const string &name) { +get_element(const std::string &name) { return &((*_object)[name]); } diff --git a/pandatool/src/xfile/xFileDataNodeTemplate.cxx b/pandatool/src/xfile/xFileDataNodeTemplate.cxx index 9f09cc0583..6464716964 100644 --- a/pandatool/src/xfile/xFileDataNodeTemplate.cxx +++ b/pandatool/src/xfile/xFileDataNodeTemplate.cxx @@ -17,6 +17,8 @@ #include "xLexerDefs.h" #include "config_xfile.h" +using std::string; + TypeHandle XFileDataNodeTemplate::_type_handle; /** @@ -127,7 +129,7 @@ add_element(XFileDataObject *element) { * Writes a suitable representation of this node to an .x file in text mode. */ void XFileDataNodeTemplate:: -write_text(ostream &out, int indent_level) const { +write_text(std::ostream &out, int indent_level) const { indent(out, indent_level) << _template->get_name(); if (has_name()) { @@ -149,7 +151,7 @@ write_text(ostream &out, int indent_level) const { * Writes a suitable representation of this node to an .x file in text mode. */ void XFileDataNodeTemplate:: -write_data(ostream &out, int indent_level, const char *separator) const { +write_data(std::ostream &out, int indent_level, const char *separator) const { if (!_nested_elements.empty()) { bool indented = false; for (size_t i = 0; i < _nested_elements.size() - 1; i++) { diff --git a/pandatool/src/xfile/xFileDataObject.cxx b/pandatool/src/xfile/xFileDataObject.cxx index 5abfa1e9ab..f3cf0b0303 100644 --- a/pandatool/src/xfile/xFileDataObject.cxx +++ b/pandatool/src/xfile/xFileDataObject.cxx @@ -21,6 +21,8 @@ #include "config_xfile.h" #include "indent.h" +using std::string; + TypeHandle XFileDataObject::_type_handle; /** @@ -168,7 +170,7 @@ add_element(XFileDataObject *element) { * Writes a suitable representation of this node to an .x file in text mode. */ void XFileDataObject:: -output_data(ostream &out) const { +output_data(std::ostream &out) const { out << "(" << get_type() << "::output_data() not implemented.)"; } @@ -176,7 +178,7 @@ output_data(ostream &out) const { * Writes a suitable representation of this node to an .x file in text mode. */ void XFileDataObject:: -write_data(ostream &out, int indent_level, const char *) const { +write_data(std::ostream &out, int indent_level, const char *) const { indent(out, indent_level) << "(" << get_type() << "::write_data() not implemented.)\n"; } diff --git a/pandatool/src/xfile/xFileDataObjectArray.cxx b/pandatool/src/xfile/xFileDataObjectArray.cxx index 10aa13d5f2..e648ef2c17 100644 --- a/pandatool/src/xfile/xFileDataObjectArray.cxx +++ b/pandatool/src/xfile/xFileDataObjectArray.cxx @@ -41,7 +41,7 @@ add_element(XFileDataObject *element) { * Writes a suitable representation of this node to an .x file in text mode. */ void XFileDataObjectArray:: -write_data(ostream &out, int indent_level, const char *separator) const { +write_data(std::ostream &out, int indent_level, const char *separator) const { if (!_nested_elements.empty()) { bool indented = false; for (size_t i = 0; i < _nested_elements.size() - 1; i++) { diff --git a/pandatool/src/xfile/xFileDataObjectDouble.cxx b/pandatool/src/xfile/xFileDataObjectDouble.cxx index 3abd4fa909..d17b2bbb1e 100644 --- a/pandatool/src/xfile/xFileDataObjectDouble.cxx +++ b/pandatool/src/xfile/xFileDataObjectDouble.cxx @@ -31,7 +31,7 @@ XFileDataObjectDouble(const XFileDataDef *data_def, double value) : * Writes a suitable representation of this node to an .x file in text mode. */ void XFileDataObjectDouble:: -output_data(ostream &out) const { +output_data(std::ostream &out) const { out << get_string_value(); } @@ -39,7 +39,7 @@ output_data(ostream &out) const { * Writes a suitable representation of this node to an .x file in text mode. */ void XFileDataObjectDouble:: -write_data(ostream &out, int indent_level, const char *separator) const { +write_data(std::ostream &out, int indent_level, const char *separator) const { indent(out, indent_level) << get_string_value() << separator << "\n"; } @@ -79,7 +79,7 @@ get_double_value() const { /** * Returns the object's representation as a string, if it has one. */ -string XFileDataObjectDouble:: +std::string XFileDataObjectDouble:: get_string_value() const { // It's important to format with a decimal point, even if the value is // integral, since the DirectX .x reader differentiates betweens doubles and diff --git a/pandatool/src/xfile/xFileDataObjectInteger.cxx b/pandatool/src/xfile/xFileDataObjectInteger.cxx index 821363f339..ee3c539d68 100644 --- a/pandatool/src/xfile/xFileDataObjectInteger.cxx +++ b/pandatool/src/xfile/xFileDataObjectInteger.cxx @@ -31,7 +31,7 @@ XFileDataObjectInteger(const XFileDataDef *data_def, int value) : * Writes a suitable representation of this node to an .x file in text mode. */ void XFileDataObjectInteger:: -output_data(ostream &out) const { +output_data(std::ostream &out) const { out << _value; } @@ -39,7 +39,7 @@ output_data(ostream &out) const { * Writes a suitable representation of this node to an .x file in text mode. */ void XFileDataObjectInteger:: -write_data(ostream &out, int indent_level, const char *separator) const { +write_data(std::ostream &out, int indent_level, const char *separator) const { indent(out, indent_level) << _value << separator << "\n"; } @@ -71,7 +71,7 @@ get_double_value() const { /** * Returns the object's representation as a string, if it has one. */ -string XFileDataObjectInteger:: +std::string XFileDataObjectInteger:: get_string_value() const { return format_string(_value); } diff --git a/pandatool/src/xfile/xFileDataObjectString.cxx b/pandatool/src/xfile/xFileDataObjectString.cxx index 3425925b22..99ef31a89f 100644 --- a/pandatool/src/xfile/xFileDataObjectString.cxx +++ b/pandatool/src/xfile/xFileDataObjectString.cxx @@ -15,6 +15,8 @@ #include "string_utils.h" #include "indent.h" +using std::string; + TypeHandle XFileDataObjectString::_type_handle; /** @@ -31,7 +33,7 @@ XFileDataObjectString(const XFileDataDef *data_def, const string &value) : * Writes a suitable representation of this node to an .x file in text mode. */ void XFileDataObjectString:: -output_data(ostream &out) const { +output_data(std::ostream &out) const { enquote_string(out); } @@ -39,7 +41,7 @@ output_data(ostream &out) const { * Writes a suitable representation of this node to an .x file in text mode. */ void XFileDataObjectString:: -write_data(ostream &out, int indent_level, const char *separator) const { +write_data(std::ostream &out, int indent_level, const char *separator) const { indent(out, indent_level); enquote_string(out); out << separator << "\n"; @@ -66,7 +68,7 @@ get_string_value() const { * special characters as needed. */ void XFileDataObjectString:: -enquote_string(ostream &out) const { +enquote_string(std::ostream &out) const { // Actually, the XFile spec doesn't tell us how to escape special characters // within quotation marks. We'll just take a stab in the dark here. diff --git a/pandatool/src/xfile/xFileNode.cxx b/pandatool/src/xfile/xFileNode.cxx index a67c7488d0..51c795e42a 100644 --- a/pandatool/src/xfile/xFileNode.cxx +++ b/pandatool/src/xfile/xFileNode.cxx @@ -21,6 +21,8 @@ #include "filename.h" #include "string_utils.h" +using std::string; + TypeHandle XFileNode::_type_handle; /** @@ -214,7 +216,7 @@ clear() { * Writes a suitable representation of this node to an .x file in text mode. */ void XFileNode:: -write_text(ostream &out, int indent_level) const { +write_text(std::ostream &out, int indent_level) const { Children::const_iterator ci; for (ci = _children.begin(); ci != _children.end(); ++ci) { (*ci)->write_text(out, indent_level); diff --git a/pandatool/src/xfile/xFileParseData.cxx b/pandatool/src/xfile/xFileParseData.cxx index aeafa42a6f..0fcd8dbef9 100644 --- a/pandatool/src/xfile/xFileParseData.cxx +++ b/pandatool/src/xfile/xFileParseData.cxx @@ -34,6 +34,6 @@ XFileParseData() : * from which this object was originally parsed. */ void XFileParseData:: -yyerror(const string &message) const { +yyerror(const std::string &message) const { xyyerror(message, _line_number, _col_number, _current_line); } diff --git a/pandatool/src/xfile/xFileTemplate.cxx b/pandatool/src/xfile/xFileTemplate.cxx index 5c9691d02a..e4ef5e2c17 100644 --- a/pandatool/src/xfile/xFileTemplate.cxx +++ b/pandatool/src/xfile/xFileTemplate.cxx @@ -20,7 +20,7 @@ TypeHandle XFileTemplate::_type_handle; * */ XFileTemplate:: -XFileTemplate(XFile *x_file, const string &name, const WindowsGuid &guid) : +XFileTemplate(XFile *x_file, const std::string &name, const WindowsGuid &guid) : XFileNode(x_file, name), _guid(guid), _is_standard(false), @@ -79,7 +79,7 @@ clear() { * Writes a suitable representation of this node to an .x file in text mode. */ void XFileTemplate:: -write_text(ostream &out, int indent_level) const { +write_text(std::ostream &out, int indent_level) const { indent(out, indent_level) << "template " << get_name() << " {\n"; indent(out, indent_level + 2) diff --git a/pandatool/src/xfile/xLexer.cxx.prebuilt b/pandatool/src/xfile/xLexer.cxx.prebuilt index a52c858c96..b808f143ee 100644 --- a/pandatool/src/xfile/xLexer.cxx.prebuilt +++ b/pandatool/src/xfile/xLexer.cxx.prebuilt @@ -643,12 +643,11 @@ goto find_rule; \ #define YY_RESTORE_YY_MORE_OFFSET char *xyytext; #line 1 "xLexer.lxx" -/* -// Filename: xLexer.lxx -// Created by: drose (03Oct04) -// -//////////////////////////////////////////////////////////////////// -*/ +/** + * @file xLexer.lxx + * @author drose + * @date 2004-10-03 + */ #line 9 "xLexer.lxx" #include "xLexerDefs.h" #include "xParserDefs.h" @@ -678,11 +677,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 x file we're parsing. We keep it so we // can print it out for error messages. -static string x_filename; +static std::string x_filename; //////////////////////////////////////////////////////////////////// @@ -690,7 +689,7 @@ static string x_filename; //////////////////////////////////////////////////////////////////// void -x_init_lexer(istream &in, const string &filename) { +x_init_lexer(std::istream &in, const std::string &filename) { input_p = ∈ x_filename = filename; x_line_number = 0; @@ -720,13 +719,13 @@ xyywrap(void) { } void -xyyerror(const string &msg) { +xyyerror(const std::string &msg) { xyyerror(msg, x_line_number, x_col_number, x_current_line); } void -xyyerror(const string &msg, int line_number, int col_number, - const string ¤t_line) { +xyyerror(const std::string &msg, int line_number, int col_number, + const std::string ¤t_line) { xfile_cat.error(false) << "\nError"; if (!x_filename.empty()) { xfile_cat.error(false) << " in " << x_filename; @@ -741,7 +740,7 @@ xyyerror(const string &msg, int line_number, int col_number, } void -xyywarning(const string &msg) { +xyywarning(const std::string &msg) { xfile_cat.warning(false) << "\nWarning"; if (!x_filename.empty()) { xfile_cat.warning(false) << " in " << x_filename; @@ -817,9 +816,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 @@ -939,7 +938,7 @@ scan_quoted_string(char quote_mark) { // scan_guid_string reads a string of hexadecimal digits delimited by // angle brackets and returns the corresponding string. -static string +static std::string scan_guid_string() { // We don't touch the current line number and column number during // scanning, so that if we detect an error while scanning the string @@ -956,7 +955,7 @@ scan_guid_string() { int num_digits = 0; int num_hyphens = 0; - string result; + std::string result; int c; c = read_char(line, col); @@ -971,7 +970,7 @@ scan_guid_string() { x_line_number = line; x_col_number = col; xyyerror("Invalid character in GUID."); - return string(); + return std::string(); } result += c; @@ -981,15 +980,15 @@ scan_guid_string() { if (c == EOF) { xyyerror("This GUID string is unterminated."); - return string(); + return std::string(); } else if (num_digits != 32) { xyyerror("Incorrect number of hex digits in GUID."); - return string(); + return std::string(); } else if (num_hyphens != 4) { xyyerror("Incorrect number of hyphens in GUID."); - return string(); + return std::string(); } x_line_number = line; @@ -1000,7 +999,7 @@ scan_guid_string() { // Parses the text into a list of integers and returns them. static PTA_int -scan_int_list(const string &text) { +scan_int_list(const std::string &text) { PTA_int result; vector_string words; @@ -1008,7 +1007,7 @@ scan_int_list(const string &text) { vector_string::const_iterator wi; for (wi = words.begin(); wi != words.end(); ++wi) { - string trimmed = trim(*wi); + std::string trimmed = trim(*wi); if (!trimmed.empty()) { int number = 0; string_to_int(trimmed, number); @@ -1021,7 +1020,7 @@ scan_int_list(const string &text) { // Parses the text into a list of doubles and returns them. static PTA_double -scan_double_list(const string &text) { +scan_double_list(const std::string &text) { PTA_double result; vector_string words; @@ -1029,7 +1028,7 @@ scan_double_list(const string &text) { vector_string::const_iterator wi; for (wi = words.begin(); wi != words.end(); ++wi) { - string trimmed = trim(*wi); + std::string trimmed = trim(*wi); if (!trimmed.empty()) { double number = 0.0; string_to_double(trimmed, number); @@ -1655,7 +1654,7 @@ YY_RULE_SETUP { // Any other character is invalid. accept(); - xyyerror("Invalid character '" + string(xyytext) + "'."); + xyyerror("Invalid character '" + std::string(xyytext) + "'."); } YY_BREAK case 35: diff --git a/pandatool/src/xfile/xLexer.lxx b/pandatool/src/xfile/xLexer.lxx index 614679ff34..c20ca309d2 100644 --- a/pandatool/src/xfile/xLexer.lxx +++ b/pandatool/src/xfile/xLexer.lxx @@ -1,9 +1,8 @@ -/* -// Filename: xLexer.lxx -// Created by: drose (03Oct04) -// -//////////////////////////////////////////////////////////////////// -*/ +/** + * @file xLexer.lxx + * @author drose + * @date 2004-10-03 + */ %{ #include "xLexerDefs.h" @@ -34,11 +33,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 x file we're parsing. We keep it so we // can print it out for error messages. -static string x_filename; +static std::string x_filename; //////////////////////////////////////////////////////////////////// @@ -46,7 +45,7 @@ static string x_filename; //////////////////////////////////////////////////////////////////// void -x_init_lexer(istream &in, const string &filename) { +x_init_lexer(std::istream &in, const std::string &filename) { input_p = ∈ x_filename = filename; x_line_number = 0; @@ -76,13 +75,13 @@ xyywrap(void) { } void -xyyerror(const string &msg) { +xyyerror(const std::string &msg) { xyyerror(msg, x_line_number, x_col_number, x_current_line); } void -xyyerror(const string &msg, int line_number, int col_number, - const string ¤t_line) { +xyyerror(const std::string &msg, int line_number, int col_number, + const std::string ¤t_line) { xfile_cat.error(false) << "\nError"; if (!x_filename.empty()) { xfile_cat.error(false) << " in " << x_filename; @@ -97,7 +96,7 @@ xyyerror(const string &msg, int line_number, int col_number, } void -xyywarning(const string &msg) { +xyywarning(const std::string &msg) { xfile_cat.warning(false) << "\nWarning"; if (!x_filename.empty()) { xfile_cat.warning(false) << " in " << x_filename; @@ -173,9 +172,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 @@ -295,7 +294,7 @@ scan_quoted_string(char quote_mark) { // scan_guid_string reads a string of hexadecimal digits delimited by // angle brackets and returns the corresponding string. -static string +static std::string scan_guid_string() { // We don't touch the current line number and column number during // scanning, so that if we detect an error while scanning the string @@ -312,7 +311,7 @@ scan_guid_string() { int num_digits = 0; int num_hyphens = 0; - string result; + std::string result; int c; c = read_char(line, col); @@ -327,7 +326,7 @@ scan_guid_string() { x_line_number = line; x_col_number = col; xyyerror("Invalid character in GUID."); - return string(); + return std::string(); } result += c; @@ -337,15 +336,15 @@ scan_guid_string() { if (c == EOF) { xyyerror("This GUID string is unterminated."); - return string(); + return std::string(); } else if (num_digits != 32) { xyyerror("Incorrect number of hex digits in GUID."); - return string(); + return std::string(); } else if (num_hyphens != 4) { xyyerror("Incorrect number of hyphens in GUID."); - return string(); + return std::string(); } x_line_number = line; @@ -356,7 +355,7 @@ scan_guid_string() { // Parses the text into a list of integers and returns them. static PTA_int -scan_int_list(const string &text) { +scan_int_list(const std::string &text) { PTA_int result; vector_string words; @@ -364,7 +363,7 @@ scan_int_list(const string &text) { vector_string::const_iterator wi; for (wi = words.begin(); wi != words.end(); ++wi) { - string trimmed = trim(*wi); + std::string trimmed = trim(*wi); if (!trimmed.empty()) { int number = 0; string_to_int(trimmed, number); @@ -377,7 +376,7 @@ scan_int_list(const string &text) { // Parses the text into a list of doubles and returns them. static PTA_double -scan_double_list(const string &text) { +scan_double_list(const std::string &text) { PTA_double result; vector_string words; @@ -385,7 +384,7 @@ scan_double_list(const string &text) { vector_string::const_iterator wi; for (wi = words.begin(); wi != words.end(); ++wi) { - string trimmed = trim(*wi); + std::string trimmed = trim(*wi); if (!trimmed.empty()) { double number = 0.0; string_to_double(trimmed, number); @@ -621,5 +620,5 @@ WHITESPACE [ ]+ . { // Any other character is invalid. accept(); - xyyerror("Invalid character '" + string(xyytext) + "'."); + xyyerror("Invalid character '" + std::string(xyytext) + "'."); } diff --git a/pandatool/src/xfile/xParser.cxx.prebuilt b/pandatool/src/xfile/xParser.cxx.prebuilt index 42c65a72a6..0d12c68d03 100644 --- a/pandatool/src/xfile/xParser.cxx.prebuilt +++ b/pandatool/src/xfile/xParser.cxx.prebuilt @@ -105,7 +105,7 @@ static PT(XFileDataDef) current_data_def; //////////////////////////////////////////////////////////////////// void -x_init_parser(istream &in, const string &filename, XFile &file) { +x_init_parser(std::istream &in, const std::string &filename, XFile &file) { x_file = &file; current_node = &file; x_init_lexer(in, filename); @@ -1803,7 +1803,7 @@ yyreduce: /* Line 1464 of yacc.c */ #line 325 "xParser.yxx" { - (yyval.str) = string(); + (yyval.str) = std::string(); } break; diff --git a/pandatool/src/xfile/xParser.yxx b/pandatool/src/xfile/xParser.yxx index 0f151c70ec..0352a4d454 100644 --- a/pandatool/src/xfile/xParser.yxx +++ b/pandatool/src/xfile/xParser.yxx @@ -39,7 +39,7 @@ static PT(XFileDataDef) current_data_def; //////////////////////////////////////////////////////////////////// void -x_init_parser(istream &in, const string &filename, XFile &file) { +x_init_parser(std::istream &in, const std::string &filename, XFile &file) { x_file = &file; current_node = &file; x_init_lexer(in, filename); @@ -324,7 +324,7 @@ multiword_name: optional_multiword_name: empty { - $$ = string(); + $$ = std::string(); } | multiword_name ; diff --git a/pandatool/src/xfileegg/xFileAnimationSet.cxx b/pandatool/src/xfileegg/xFileAnimationSet.cxx index 112b61ba12..f76bc33ee9 100644 --- a/pandatool/src/xfileegg/xFileAnimationSet.cxx +++ b/pandatool/src/xfileegg/xFileAnimationSet.cxx @@ -59,7 +59,7 @@ create_hierarchy(XFileToEggConverter *converter) { // Now populate those empty tables with the frame data. JointData::const_iterator ji; for (ji = _joint_data.begin(); ji != _joint_data.end(); ++ji) { - const string &joint_name = (*ji).first; + const std::string &joint_name = (*ji).first; const FrameData &table = (*ji).second; EggXfmSAnim *anim_table = get_table(joint_name); @@ -98,7 +98,7 @@ create_hierarchy(XFileToEggConverter *converter) { * Returns the table associated with the indicated joint name. */ EggXfmSAnim *XFileAnimationSet:: -get_table(const string &joint_name) const { +get_table(const std::string &joint_name) const { Tables::const_iterator ti; ti = _tables.find(joint_name); if (ti != _tables.end()) { @@ -112,7 +112,7 @@ get_table(const string &joint_name) const { * joint. */ XFileAnimationSet::FrameData &XFileAnimationSet:: -create_frame_data(const string &joint_name) { +create_frame_data(const std::string &joint_name) { return _joint_data[joint_name]; } diff --git a/pandatool/src/xfileegg/xFileMaker.cxx b/pandatool/src/xfileegg/xFileMaker.cxx index 915fa4ff20..e3d07cea0b 100644 --- a/pandatool/src/xfileegg/xFileMaker.cxx +++ b/pandatool/src/xfileegg/xFileMaker.cxx @@ -234,7 +234,7 @@ bool XFileMaker:: finalize_mesh(XFileNode *x_parent, XFileMesh *mesh) { // Get a unique number for each mesh. _mesh_index++; - string mesh_index = format_string(_mesh_index); + std::string mesh_index = format_string(_mesh_index); // Finally, create the Mesh object. mesh->make_x_mesh(x_parent, mesh_index); diff --git a/pandatool/src/xfileegg/xFileMaterial.cxx b/pandatool/src/xfileegg/xFileMaterial.cxx index 4efa732b4d..11457ebcd5 100644 --- a/pandatool/src/xfileegg/xFileMaterial.cxx +++ b/pandatool/src/xfileegg/xFileMaterial.cxx @@ -161,7 +161,7 @@ has_texture() const { * Creates a Material object for the material list. */ XFileDataNode *XFileMaterial:: -make_x_material(XFileNode *x_meshMaterials, const string &suffix) { +make_x_material(XFileNode *x_meshMaterials, const std::string &suffix) { XFileDataNode *x_material = x_meshMaterials->add_Material("material" + suffix, _face_color, _power, diff --git a/pandatool/src/xfileegg/xFileMesh.cxx b/pandatool/src/xfileegg/xFileMesh.cxx index 9ddf66bc0e..4fad113ed4 100644 --- a/pandatool/src/xfileegg/xFileMesh.cxx +++ b/pandatool/src/xfileegg/xFileMesh.cxx @@ -24,6 +24,9 @@ #include "eggPolygon.h" #include "eggGroupNode.h" +using std::min; +using std::string; + /** * */ @@ -111,7 +114,7 @@ add_vertex(EggVertex *egg_vertex, EggPrimitive *egg_prim) { _has_uvs = true; } - pair result = + std::pair result = _unique_vertices.insert(UniqueVertices::value_type(vertex, next_index)); if (result.second) { @@ -140,7 +143,7 @@ add_normal(EggVertex *egg_vertex, EggPrimitive *egg_prim) { _has_normals = true; } - pair result = + std::pair result = _unique_normals.insert(UniqueNormals::value_type(normal, next_index)); if (result.second) { @@ -168,7 +171,7 @@ add_material(EggPrimitive *egg_prim) { _has_materials = true; } - pair result = + std::pair result = _unique_materials.insert(UniqueMaterials::value_type(material, next_index)); if (result.second) { diff --git a/pandatool/src/xfileegg/xFileToEggConverter.cxx b/pandatool/src/xfileegg/xFileToEggConverter.cxx index 2f65643c0f..130c42546e 100644 --- a/pandatool/src/xfileegg/xFileToEggConverter.cxx +++ b/pandatool/src/xfileegg/xFileToEggConverter.cxx @@ -26,6 +26,8 @@ #include "eggTextureCollection.h" #include "dcast.h" +using std::string; + /** * */