Skip to content

Commit e1fa3be

Browse files
Found some more files were using namespace std
1 parent e9ac903 commit e1fa3be

File tree

12 files changed

+44
-53
lines changed

12 files changed

+44
-53
lines changed

examples/tv-app/android/include/account-login/AccountLoginManager.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const auto loginSetupPINFieldId = std::to_string(chip::to_underlying(AccountLogi
3535
const auto loginNodeFieldId = std::to_string(chip::to_underlying(AccountLogin::Commands::Login::Fields::kNode));
3636
const auto logoutNodeFieldId = std::to_string(chip::to_underlying(AccountLogin::Commands::Logout::Fields::kNode));
3737

38-
string charSpanToString(const CharSpan & charSpan)
38+
std::string charSpanToString(const CharSpan & charSpan)
3939
{
4040
return { charSpan.data(), charSpan.size() };
4141
}
@@ -127,10 +127,10 @@ bool AccountLoginManager::HandleLogout(const chip::Optional<chip::NodeId> & node
127127
void AccountLoginManager::HandleGetSetupPin(CommandResponseHelper<GetSetupPINResponse> & helper,
128128
const CharSpan & tempAccountIdentifier)
129129
{
130-
string tempAccountIdentifierString(tempAccountIdentifier.data(), tempAccountIdentifier.size());
130+
std::string tempAccountIdentifierString(tempAccountIdentifier.data(), tempAccountIdentifier.size());
131131

132132
GetSetupPINResponse response;
133-
ChipLogProgress(Zcl, "temporary account id: %s returning pin: %s", tempAccountIdentifierString.c_str(), mSetupPin);
133+
ChipLogProgress(Zcl, "temporary account id: %s returning pin: %s", tempAccountIdentifierString.std::c_str(), mSetupPin);
134134

135135
response.setupPIN = CharSpan::fromCharString(mSetupPin);
136136
helper.Success(response);
@@ -143,7 +143,7 @@ void AccountLoginManager::GetSetupPin(char * setupPin, size_t setupPinSize, cons
143143
// Other methods in this class do not need to be changed beecause those will get routed to java layer
144144
// upstream.
145145
ChipLogProgress(DeviceLayer, "AccountLoginManager::GetSetupPin called for endpoint %d", mEndpointId);
146-
string tempAccountIdentifierString(tempAccountIdentifier.data(), tempAccountIdentifier.size());
146+
std::string tempAccountIdentifierString(tempAccountIdentifier.data(), tempAccountIdentifier.size());
147147
if (mCommandDelegate == nullptr)
148148
{
149149
// For the dummy content apps to work.

examples/tv-app/android/include/content-launcher/AppContentLauncherManager.cpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ using namespace chip::app::Clusters::ContentLauncher;
3131
using ContentAppAttributeDelegate = chip::AppPlatform::ContentAppAttributeDelegate;
3232

3333
AppContentLauncherManager::AppContentLauncherManager(ContentAppAttributeDelegate * attributeDelegate,
34-
list<std::string> acceptHeaderList, uint32_t supportedStreamingProtocols) :
34+
std::list<std::string> acceptHeaderList, uint32_t supportedStreamingProtocols) :
3535
mAttributeDelegate(attributeDelegate)
3636
{
3737
mAcceptHeaderList = acceptHeaderList;
@@ -45,7 +45,7 @@ void AppContentLauncherManager::HandleLaunchContent(CommandResponseHelper<Launch
4545
bool useCurrentContext)
4646
{
4747
ChipLogProgress(Zcl, "AppContentLauncherManager::HandleLaunchContent for endpoint %d", mEndpointId);
48-
string dataString(data.data(), data.size());
48+
std::string dataString(data.data(), data.size());
4949

5050
ChipLogProgress(Zcl, " AutoPlay=%s", (autoplay ? "true" : "false"));
5151

@@ -75,8 +75,8 @@ void AppContentLauncherManager::HandleLaunchUrl(CommandResponseHelper<LaunchResp
7575
{
7676
ChipLogProgress(Zcl, "AppContentLauncherManager::HandleLaunchUrl");
7777

78-
string contentUrlString(contentUrl.data(), contentUrl.size());
79-
string displayStringString(displayString.data(), displayString.size());
78+
std::string contentUrlString(contentUrl.data(), contentUrl.size());
79+
std::string displayStringString(displayString.data(), displayString.size());
8080

8181
// TODO: Insert code here
8282
LaunchResponseType response;
@@ -91,7 +91,7 @@ CHIP_ERROR AppContentLauncherManager::HandleGetAcceptHeaderList(AttributeValueEn
9191
chip::app::ConcreteReadAttributePath aPath(mEndpointId, chip::app::Clusters::ContentLauncher::Id,
9292
chip::app::Clusters::ContentLauncher::Attributes::AcceptHeader::Id);
9393
std::string resStr = mAttributeDelegate->Read(aPath);
94-
ChipLogProgress(Zcl, "AppContentLauncherManager::HandleGetAcceptHeaderList response %s", resStr.c_str());
94+
ChipLogProgress(Zcl, "AppContentLauncherManager::HandleGetAcceptHeaderList response %s", resStr.std::c_str());
9595

9696
if (resStr.length() != 0)
9797
{
@@ -101,7 +101,7 @@ CHIP_ERROR AppContentLauncherManager::HandleGetAcceptHeaderList(AttributeValueEn
101101
{
102102
std::string attrId = std::to_string(chip::app::Clusters::ContentLauncher::Attributes::AcceptHeader::Id);
103103
ChipLogProgress(Zcl, "AppContentLauncherManager::HandleGetAcceptHeaderList response parsing done. reading attr %s",
104-
attrId.c_str());
104+
attrId.std::c_str());
105105
if (value[attrId].isArray())
106106
{
107107
mAcceptHeaderList.clear();
@@ -132,7 +132,7 @@ uint32_t AppContentLauncherManager::HandleGetSupportedStreamingProtocols()
132132
chip::app::ConcreteReadAttributePath aPath(mEndpointId, chip::app::Clusters::ContentLauncher::Id,
133133
chip::app::Clusters::ContentLauncher::Attributes::SupportedStreamingProtocols::Id);
134134
std::string resStr = mAttributeDelegate->Read(aPath);
135-
ChipLogProgress(Zcl, "AppContentLauncherManager::HandleGetSupportedStreamingProtocols response %s", resStr.c_str());
135+
ChipLogProgress(Zcl, "AppContentLauncherManager::HandleGetSupportedStreamingProtocols response %s", resStr.std::c_str());
136136

137137
if (resStr.length() == 0)
138138
{
@@ -147,7 +147,7 @@ uint32_t AppContentLauncherManager::HandleGetSupportedStreamingProtocols()
147147
}
148148
std::string attrId = std::to_string(chip::app::Clusters::ContentLauncher::Attributes::SupportedStreamingProtocols::Id);
149149
ChipLogProgress(Zcl, "AppContentLauncherManager::HandleGetSupportedStreamingProtocols response parsing done. reading attr %s",
150-
attrId.c_str());
150+
attrId.std::c_str());
151151
if (!value[attrId].empty() && value[attrId].isInt())
152152
{
153153
uint32_t supportedStreamingProtocols = static_cast<uint32_t>(value[attrId].asInt());

examples/tv-app/android/include/media-playback/AppMediaPlaybackManager.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ uint64_t AppMediaPlaybackManager::HandleMediaRequestGetAttribute(chip::Attribute
194194
ChipLogProgress(Zcl, "Received AppMediaPlaybackManager::HandleMediaRequestGetAttribute:%d", attributeId);
195195
chip::app::ConcreteReadAttributePath aPath(mEndpointId, chip::app::Clusters::MediaPlayback::Id, attributeId);
196196
std::string resStr = mAttributeDelegate->Read(aPath);
197-
ChipLogProgress(Zcl, "AppMediaPlaybackManager::HandleMediaRequestGetAttribute response %s", resStr.c_str());
197+
ChipLogProgress(Zcl, "AppMediaPlaybackManager::HandleMediaRequestGetAttribute response %s", resStr.std::c_str());
198198

199199
uint64_t ret = std::numeric_limits<uint64_t>::max();
200200
if (resStr.length() != 0)
@@ -205,7 +205,7 @@ uint64_t AppMediaPlaybackManager::HandleMediaRequestGetAttribute(chip::Attribute
205205
{
206206
std::string attrId = std::to_string(attributeId);
207207
ChipLogProgress(Zcl, "AppMediaPlaybackManager::HandleMediaRequestGetAttribute response parsing done. reading attr %s",
208-
attrId.c_str());
208+
attrId.std::c_str());
209209
if (!value[attrId].empty() && value[attrId].isUInt())
210210
{
211211
ret = static_cast<uint64_t>(value[attrId].asUInt());
@@ -241,7 +241,7 @@ CHIP_ERROR AppMediaPlaybackManager::HandleGetSampledPosition(AttributeValueEncod
241241
chip::app::ConcreteReadAttributePath aPath(mEndpointId, chip::app::Clusters::MediaPlayback::Id,
242242
chip::app::Clusters::MediaPlayback::Attributes::SampledPosition::Id);
243243
std::string resStr = mAttributeDelegate->Read(aPath);
244-
ChipLogProgress(Zcl, "AppMediaPlaybackManager::HandleGetSampledPosition response %s", resStr.c_str());
244+
ChipLogProgress(Zcl, "AppMediaPlaybackManager::HandleGetSampledPosition response %s", resStr.std::c_str());
245245

246246
if (resStr.length() != 0)
247247
{
@@ -251,7 +251,7 @@ CHIP_ERROR AppMediaPlaybackManager::HandleGetSampledPosition(AttributeValueEncod
251251
{
252252
std::string attrId = std::to_string(chip::app::Clusters::MediaPlayback::Attributes::SampledPosition::Id);
253253
ChipLogProgress(Zcl, "AppContentLauncherManager::HandleGetSampledPosition response parsing done. reading attr %s",
254-
attrId.c_str());
254+
attrId.std::c_str());
255255
if (!value[attrId].empty() && value[attrId].isObject())
256256
{
257257
std::string updatedAt = std::to_string(

examples/tv-app/android/include/target-navigator/TargetNavigatorManager.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ CHIP_ERROR TargetNavigatorManager::HandleGetTargetList(AttributeValueEncoder & a
5454
{
5555
std::string attrId = std::to_string(chip::app::Clusters::TargetNavigator::Attributes::TargetList::Id);
5656
ChipLogProgress(Zcl, "TargetNavigatorManager::HandleNavigateTarget response parsing done. reading attr %s",
57-
attrId.c_str());
57+
attrId.std::c_str());
5858
if (value[attrId].isArray())
5959
{
6060
return aEncoder.EncodeList([&](const auto & encoder) -> CHIP_ERROR {
@@ -109,7 +109,7 @@ uint8_t TargetNavigatorManager::HandleGetCurrentTarget()
109109
chip::app::ConcreteReadAttributePath aPath(mEndpointId, chip::app::Clusters::TargetNavigator::Id,
110110
chip::app::Clusters::TargetNavigator::Attributes::TargetList::Id);
111111
std::string resStr = mAttributeDelegate->Read(aPath);
112-
ChipLogProgress(Zcl, "TargetNavigatorManager::HandleGetCurrentTarget response %s", resStr.c_str());
112+
ChipLogProgress(Zcl, "TargetNavigatorManager::HandleGetCurrentTarget response %s", resStr.std::c_str());
113113

114114
if (resStr.length() != 0)
115115
{
@@ -119,7 +119,7 @@ uint8_t TargetNavigatorManager::HandleGetCurrentTarget()
119119
{
120120
std::string attrId = std::to_string(chip::app::Clusters::TargetNavigator::Attributes::CurrentTarget::Id);
121121
ChipLogProgress(Zcl, "TargetNavigatorManager::HandleGetCurrentTarget response parsing done. reading attr %s",
122-
attrId.c_str());
122+
attrId.std::c_str());
123123
if (value[attrId].isUInt() && value[attrId].asUInt() < 256)
124124
{
125125
return static_cast<uint8_t>(value[attrId].asUInt());

examples/tv-app/tv-common/clusters/media-input/MediaInputManager.cpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
#include <string>
2121

22-
using namespace std;
2322
using namespace chip;
2423
using namespace chip::app::Clusters::MediaInput;
2524

@@ -76,11 +75,11 @@ bool MediaInputManager::HandleShowInputStatus()
7675
ChipLogProgress(Zcl, " MediaInputManager::HandleShowInputStatus()");
7776
for (auto const & inputInfo : this->mInputs)
7877
{
79-
string name(inputInfo.name.data(), inputInfo.name.size());
80-
string desc(inputInfo.description.data(), inputInfo.description.size());
78+
std::string name(inputInfo.name.data(), inputInfo.name.size());
79+
std::string desc(inputInfo.description.data(), inputInfo.description.size());
8180
ChipLogProgress(Zcl, " [%d] type=%d selected=%d name=%s desc=%s", inputInfo.index,
8281
static_cast<uint16_t>(inputInfo.inputType), (mCurrentInput == inputInfo.index ? 1 : 0), name.c_str(),
83-
desc.c_str());
82+
desc.std::c_str());
8483
}
8584
return true;
8685
}

examples/tv-app/tv-common/clusters/media-playback/MediaPlaybackManager.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
#include <string>
2323

24-
using namespace std;
2524
using namespace chip::app::DataModel;
2625
using namespace chip::app::Clusters::MediaPlayback;
2726
using namespace chip::Uint8;

examples/tv-app/tv-common/clusters/messages/MessagesManager.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include <string>
2222
#include <vector>
2323

24-
using namespace std;
2524
using namespace chip;
2625
using namespace chip::app;
2726
using namespace chip::app::Clusters::Messages;
@@ -34,7 +33,7 @@ CHIP_ERROR MessagesManager::HandlePresentMessagesRequest(
3433
const DataModel::Nullable<uint32_t> & startTime, const DataModel::Nullable<uint64_t> & duration, const CharSpan & messageText,
3534
const Optional<DataModel::DecodableList<MessageResponseOption>> & responses)
3635
{
37-
ChipLogProgress(Zcl, "HandlePresentMessagesRequest message:%s", std::string(messageText.data(), messageText.size()).c_str());
36+
ChipLogProgress(Zcl, "HandlePresentMessagesRequest message:%s", std::string(messageText.data(), messageText.size()).std::c_str());
3837

3938
auto cachedMessage = CachedMessage(messageId, priority, messageControl, startTime, duration,
4039
std::string(messageText.data(), messageText.size()));

examples/tv-app/tv-common/clusters/target-navigator/TargetNavigatorManager.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
#include <string>
2323

24-
using namespace std;
2524
using namespace chip::app;
2625
using namespace chip::app::Clusters::TargetNavigator;
2726

examples/tv-casting-app/tv-casting-common/clusters/content-app-observer/ContentAppObserver.cpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include <app-common/zap-generated/attributes/Accessors.h>
2121
#include <app/util/config.h>
2222

23-
using namespace std;
2423
using namespace chip;
2524
using namespace chip::app::Clusters::ContentAppObserver;
2625

@@ -35,11 +34,11 @@ void ContentAppObserverManager::HandleContentAppMessage(chip::app::CommandRespon
3534
{
3635
ChipLogProgress(Zcl, "ContentAppObserverManager::HandleContentAppMessage");
3736

38-
string dataString(data.HasValue() ? data.Value().data() : "", data.HasValue() ? data.Value().size() : 0);
39-
string encodingHintString(encodingHint.data(), encodingHint.size());
37+
std::string dataString(data.HasValue() ? data.Value().data() : "", data.HasValue() ? data.Value().size() : 0);
38+
std::string encodingHintString(encodingHint.data(), encodingHint.size());
4039

4140
ChipLogProgress(Zcl, "ContentAppObserverManager::HandleContentAppMessage TEST CASE hint=%s data=%s ",
42-
encodingHintString.c_str(), dataString.c_str());
41+
encodingHintString.std::c_str(), dataString.std::c_str());
4342

4443
ContentAppMessageResponse response;
4544
// TODO: Insert code here

examples/tv-casting-app/tv-casting-common/core/CastingPlayerDiscovery.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ namespace core {
2525
using namespace chip::System;
2626
using namespace chip::Controller;
2727
using namespace chip::Dnssd;
28-
using namespace std;
2928

3029
CastingPlayerDiscovery * CastingPlayerDiscovery::_castingPlayerDiscovery = nullptr;
3130

src/app/clusters/resource-monitoring-server/resource-monitoring-server.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
#include <lib/support/TypeTraits.h>
3535
#include <protocols/interaction_model/StatusCode.h>
3636

37-
// using namespace std;
3837
using namespace chip::app;
3938
using namespace chip::app::Clusters;
4039
using namespace chip::app::Clusters::ResourceMonitoring;

src/lib/support/SafeInt.h

+18-20
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,10 @@ namespace chip {
3737
template <typename T, typename U, std::enable_if_t<std::is_integral<T>::value, int> = 0>
3838
bool CanCastTo(U arg)
3939
{
40-
using namespace std;
4140
// U might be a reference to an integer type, if we're assigning from
4241
// something passed by reference.
43-
typedef typename remove_reference<U>::type V; // V for "value"
44-
static_assert(is_integral<V>::value, "Must be assigning from an integral type");
42+
typedef typename std::remove_reference<U>::type V; // V for "value"
43+
static_assert(std::is_integral<V>::value, "Must be assigning from an integral type");
4544

4645
// We want to check that "arg" can fit inside T but without doing any tests
4746
// that are always true or always false due to the types involved, which
@@ -64,44 +63,44 @@ bool CanCastTo(U arg)
6463
// of T and V is signed and the other is unsigned: there might not be a
6564
// single integer type that can represent _both_ the value of arg and the
6665
// minimal/maximal value.
67-
if (numeric_limits<T>::is_signed && numeric_limits<V>::is_signed)
66+
if (std::numeric_limits<T>::is_signed && std::numeric_limits<V>::is_signed)
6867
{
69-
if (static_cast<intmax_t>(numeric_limits<V>::max()) <= static_cast<intmax_t>(numeric_limits<T>::max()) &&
70-
static_cast<intmax_t>(numeric_limits<V>::min()) >= static_cast<intmax_t>(numeric_limits<T>::min()))
68+
if (static_cast<intmax_t>(std::numeric_limits<V>::max()) <= static_cast<intmax_t>(std::numeric_limits<T>::max()) &&
69+
static_cast<intmax_t>(std::numeric_limits<V>::min()) >= static_cast<intmax_t>(std::numeric_limits<T>::min()))
7170
{
7271
// Any checks on arg would be trivially true; don't even do them, to
7372
// avoid warnings.
7473
return true;
7574
}
7675

77-
return static_cast<intmax_t>(numeric_limits<T>::min()) <= static_cast<intmax_t>(arg) &&
78-
static_cast<intmax_t>(arg) <= static_cast<intmax_t>(numeric_limits<T>::max());
76+
return static_cast<intmax_t>(std::numeric_limits<T>::min()) <= static_cast<intmax_t>(arg) &&
77+
static_cast<intmax_t>(arg) <= static_cast<intmax_t>(std::numeric_limits<T>::max());
7978
}
8079

81-
if (!numeric_limits<T>::is_signed && !numeric_limits<V>::is_signed)
80+
if (!std::numeric_limits<T>::is_signed && !std::numeric_limits<V>::is_signed)
8281
{
83-
if (static_cast<uintmax_t>(numeric_limits<V>::max()) <= static_cast<uintmax_t>(numeric_limits<T>::max()))
82+
if (static_cast<uintmax_t>(std::numeric_limits<V>::max()) <= static_cast<uintmax_t>(std::numeric_limits<T>::max()))
8483
{
8584
// Any checks on arg would be trivially true; don't even do them, to
8685
// avoid warnings.
8786
return true;
8887
}
8988

90-
return static_cast<uintmax_t>(arg) <= static_cast<uintmax_t>(numeric_limits<T>::max());
89+
return static_cast<uintmax_t>(arg) <= static_cast<uintmax_t>(std::numeric_limits<T>::max());
9190
}
9291

93-
if (numeric_limits<T>::is_signed)
92+
if (std::numeric_limits<T>::is_signed)
9493
{
95-
static_assert(numeric_limits<T>::max() >= 0, "What weird type is this?");
96-
if (static_cast<uintmax_t>(numeric_limits<V>::max()) <= static_cast<uintmax_t>(numeric_limits<T>::max()))
94+
static_assert(std::numeric_limits<T>::max() >= 0, "What weird type is this?");
95+
if (static_cast<uintmax_t>(std::numeric_limits<V>::max()) <= static_cast<uintmax_t>(std::numeric_limits<T>::max()))
9796
{
9897
return true;
9998
}
10099

101-
return static_cast<uintmax_t>(arg) <= static_cast<uintmax_t>(numeric_limits<T>::max());
100+
return static_cast<uintmax_t>(arg) <= static_cast<uintmax_t>(std::numeric_limits<T>::max());
102101
}
103102

104-
return 0 <= arg && static_cast<uintmax_t>(arg) <= static_cast<uintmax_t>(numeric_limits<T>::max());
103+
return 0 <= arg && static_cast<uintmax_t>(arg) <= static_cast<uintmax_t>(std::numeric_limits<T>::max());
105104
}
106105

107106
template <typename T, typename U, std::enable_if_t<std::is_enum<T>::value, int> = 0>
@@ -127,10 +126,9 @@ bool CanCastTo(U arg)
127126
template <typename T>
128127
typename std::enable_if<std::is_unsigned<T>::value, typename std::make_signed<T>::type>::type CastToSigned(T arg)
129128
{
130-
using namespace std;
131-
typedef typename make_signed<T>::type signed_type;
129+
typedef typename std::make_signed<T>::type signed_type;
132130

133-
if (arg <= static_cast<T>(numeric_limits<signed_type>::max()))
131+
if (arg <= static_cast<T>(std::numeric_limits<signed_type>::max()))
134132
{
135133
return static_cast<signed_type>(arg);
136134
}
@@ -142,7 +140,7 @@ typename std::enable_if<std::is_unsigned<T>::value, typename std::make_signed<T>
142140
//
143141
// then noting that both (numeric_limits<T>::max() - arg) and its negation
144142
// are guaranteed to fit in signed_type.
145-
signed_type diff = static_cast<signed_type>(numeric_limits<T>::max() - arg);
143+
signed_type diff = static_cast<signed_type>(std::numeric_limits<T>::max() - arg);
146144
return static_cast<signed_type>(-diff - 1);
147145
}
148146

0 commit comments

Comments
 (0)