ipfs-chromium
slash_delimited.h
1 #ifndef IPFS_SLASH_DELIMITED_H_
2 #define IPFS_SLASH_DELIMITED_H_
3 
4 #include <iosfwd>
5 #include <string>
6 #include <string_view>
7 
8 namespace google::protobuf::internal {
9 class LogMessage;
10 }
11 
12 namespace ipfs {
16  std::string_view remainder_;
17 
18  public:
19  SlashDelimited() : remainder_{""} {}
20  explicit SlashDelimited(std::string_view unowned);
21  explicit operator bool() const;
22  std::string_view pop();
23  std::string_view pop_all();
24  std::string_view pop_n(std::size_t);
25  std::string_view peek_back() const;
26  std::string pop_back();
27  std::string to_string() const { return std::string{remainder_}; }
28  std::string_view to_view() const { return remainder_; }
29 };
30 } // namespace ipfs
31 
32 std::ostream& operator<<(std::ostream&, ipfs::SlashDelimited const&);
33 google::protobuf::internal::LogMessage& operator<<(
34  google::protobuf::internal::LogMessage&,
35  ipfs::SlashDelimited const&);
36 
37 #endif // IPFS_SLASH_DELIMITED_H_
Definition: slash_delimited.h:15