solve hw-9
This commit is contained in:
33
hws/tiktok_trends/Utils.h
Normal file
33
hws/tiktok_trends/Utils.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <unordered_map>
|
||||
#include <fstream>
|
||||
#include "StringInterner.h"
|
||||
#include "VideoInfo.h"
|
||||
#include "HashtagInfo.h"
|
||||
#include "SoundInfo.h"
|
||||
#include "StringPtrUtils.h" // Needed for HashtagMapType/SoundMapType in function signatures
|
||||
|
||||
bool parseQuotedStringValue(const std::string& str, size_t& pos, std::string& value);
|
||||
bool parseUnquotedValue(const std::string& str, size_t& pos, std::string& value);
|
||||
bool extractValue(const std::string& line, const std::string& key, std::string& value);
|
||||
bool extractSubObject(const std::string& line, const std::string& key, std::string& subObj);
|
||||
bool parseLongLong(const std::string& s, long& result);
|
||||
|
||||
bool parseLineForHashtags(const std::string& line, int inputOrder, StringInterner& interner,
|
||||
VideoInfo& outVideo, std::string& outText);
|
||||
|
||||
bool parseLineForSounds(const std::string& line, int inputOrder, StringInterner& interner,
|
||||
VideoInfo& outVideo,
|
||||
const std::string*& outMusicIdPtr,
|
||||
const std::string*& outMusicNamePtr,
|
||||
const std::string*& outMusicAuthorPtr);
|
||||
|
||||
void extractHashtags(const std::string& text,
|
||||
std::unordered_map<const std::string*, HashtagInfo, StringPtrHash, StringPtrEqual>& hashtagData,
|
||||
StringInterner& interner,
|
||||
const VideoInfo& video);
|
||||
|
||||
void extractSortAndPrintTop3Videos(std::ofstream& fout, TopKVideoHolder& topVideos);
|
||||
Reference in New Issue
Block a user