VirtualBox

Changeset 26122 in vbox


Ignore:
Timestamp:
Feb 1, 2010 2:23:08 PM (15 years ago)
Author:
vboxsync
Message:

Main/Performance: Use iprt::MiniString instead of std::string.

Location:
trunk/src/VBox/Main
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/Performance.cpp

    r25149 r26122  
    505505
    506506    for (size_t pos = name.find(",");
    507          pos != std::string::npos;
     507         pos != com::Utf8Str::npos;
    508508         pos = name.find(",", startPos))
    509509    {
    510         mElements.push_back(std::make_pair(object, std::string(name.substr(startPos, pos - startPos).c_str())));
     510        mElements.push_back(std::make_pair(object, iprt::MiniString(name.substr(startPos, pos - startPos).c_str())));
    511511        startPos = pos + 1;
    512512    }
    513     mElements.push_back(std::make_pair(object, std::string(name.substr(startPos).c_str())));
     513    mElements.push_back(std::make_pair(object, iprt::MiniString(name.substr(startPos).c_str())));
    514514}
    515515
     
    587587}
    588588
    589 bool Filter::match(const ComPtr<IUnknown> object, const std::string &name) const
     589bool Filter::match(const ComPtr<IUnknown> object, const iprt::MiniString &name) const
    590590{
    591591    ElementList::const_iterator it;
  • trunk/src/VBox/Main/include/Performance.h

    r22173 r26122  
    2525#include <VBox/com/defs.h>
    2626#include <VBox/com/ptr.h>
     27#include <VBox/com/string.h>
    2728
    2829#include <iprt/types.h>
    2930#include <iprt/err.h>
    3031
    31 #include <algorithm>
    3232#include <list>
    33 #include <string>
    3433#include <vector>
    35 
    36 namespace com
    37 {
    38     class Utf8Str;
    39 }
    4034
    4135namespace pm
     
    8478    typedef int HintFlags;
    8579    typedef std::pair<RTPROCESS, HintFlags> ProcessFlagsPair;
    86 
    87     inline bool processEqual(ProcessFlagsPair pair, RTPROCESS process)
    88     {
    89         return pair.first == process;
    90     }
    9180
    9281    class CollectorHints
     
    130119        {
    131120            ProcessList::iterator it;
    132 
    133             it = std::find_if(mProcesses.begin(),
    134                               mProcesses.end(),
    135                               std::bind2nd(std::ptr_fun(processEqual), process));
    136 
    137             if (it != mProcesses.end())
    138                 return *it;
     121            for (it = mProcesses.begin(); it != mProcesses.end(); it++)
     122                if (it->first == process)
     123                    return *it;
    139124
    140125            /* Not found -- add new */
     
    369354            if (mAggregate)
    370355            {
    371                 mName += ":";
    372                 mName += mAggregate->getName();
     356                mName.append(":");
     357                mName.append(mAggregate->getName());
    373358            }
    374359        }
     
    394379
    395380    private:
    396         std::string mName;
     381        iprt::MiniString mName;
    397382        BaseMetric *mBaseMetric;
    398383        SubMetric  *mSubMetric;
     
    409394        static bool patternMatch(const char *pszPat, const char *pszName,
    410395                                 bool fSeenColon = false);
    411         bool match(const ComPtr<IUnknown> object, const std::string &name) const;
     396        bool match(const ComPtr<IUnknown> object, const iprt::MiniString &name) const;
    412397    private:
    413398        void init(ComSafeArrayIn(IN_BSTR, metricNames),
    414399                  ComSafeArrayIn(IUnknown * , objects));
    415400
    416         typedef std::pair<const ComPtr<IUnknown>, const std::string> FilterElement;
     401        typedef std::pair<const ComPtr<IUnknown>, const iprt::MiniString> FilterElement;
    417402        typedef std::list<FilterElement> ElementList;
    418403
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette