Common/Network: Get rid of out parameters for MAC address utilities

Given we have std::array and std::optional, we can use these in
conjunction with one another to avoid the need for out parameters.
This commit is contained in:
Lioncash
2018-06-10 14:32:33 -04:00
parent 70417c8d16
commit ce69201f33
9 changed files with 77 additions and 58 deletions

View File

@ -4,6 +4,8 @@
#pragma once
#include <array>
#include <optional>
#include <string>
#include "Common/CommonTypes.h"
@ -21,7 +23,9 @@ enum
MAC_ADDRESS_SIZE = 6
};
void GenerateMacAddress(const MACConsumer type, u8* mac);
std::string MacAddressToString(const u8* mac);
bool StringToMacAddress(const std::string& mac_string, u8* mac);
using MACAddress = std::array<u8, MAC_ADDRESS_SIZE>;
MACAddress GenerateMacAddress(MACConsumer type);
std::string MacAddressToString(const MACAddress& mac);
std::optional<MACAddress> StringToMacAddress(const std::string& mac_string);
} // namespace Common