Skip to content

Commit

Permalink
Add methods for calculating package name #24
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeyxo committed Jan 29, 2015
1 parent 414bc5c commit ccd779e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/compiler/swift_helpers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,21 @@ namespace google { namespace protobuf { namespace compiler { namespace swift {
return tokens;
}

string PackageName(const FileDescriptor* file)
{

return PackageName(PackageSplit(file->package()));
}

string PackageName(const vector<string> splitVector)
{
string result;
for (int i = 0; i < splitVector.size(); i++) {
result += splitVector[i];
result += ".";
}
return result;
}

string ClassNameWorker(const Descriptor* descriptor) {
string name;
Expand Down
5 changes: 5 additions & 0 deletions src/compiler/swift_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ namespace google {
// Returns true if the name requires a ns_returns_not_retained attribute applied
// to it.


//Packages
vector<string> PackageSplit(const string& str);
string PackageName(const FileDescriptor* file);
string PackageName(const vector<string> splitVector);
///

bool IsBootstrapFile(const FileDescriptor* file);

Expand Down

0 comments on commit ccd779e

Please sign in to comment.