mirror of
https://github.com/SerenityOS/serenity
synced 2024-07-23 11:04:40 +00:00
Base: Split out cpp-library template files into actual files
These were part of the postcreate script previously, but with the new powers of sed, we can text-replace the library name and make changing them much more convenient.
This commit is contained in:
parent
2451e97a11
commit
fd68e9f1ac
|
@ -4,6 +4,10 @@
|
|||
# $2: Project full path
|
||||
# $3: Project name, namespace safe
|
||||
|
||||
# FIXME: Use a single sed command once we support that.
|
||||
sed -i "s/\\\$LibName/$3/g" $2/Class1.h
|
||||
sed -i "s/\\\$LibName/$3/g" $2/Class1.cpp
|
||||
|
||||
# Generate Makefile
|
||||
echo > $2/Makefile <<-EOF
|
||||
LIBRARY = $1.so
|
||||
|
@ -22,34 +26,3 @@ clean:
|
|||
rm \$(OBJS) \$(LIBRARY)
|
||||
|
||||
EOF
|
||||
|
||||
# Generate 'Class1' header file
|
||||
echo > $2/Class1.h <<-EOF
|
||||
#pragma once
|
||||
|
||||
namespace $3 {
|
||||
|
||||
class Class1 {
|
||||
public:
|
||||
void hello();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
EOF
|
||||
|
||||
# Generate 'Class1' source file
|
||||
echo > $2/Class1.cpp <<-EOF
|
||||
#include "Class1.h"
|
||||
#include <stdio.h>
|
||||
|
||||
namespace $3 {
|
||||
|
||||
void Class1::hello()
|
||||
{
|
||||
printf("Hello friends! :^)\\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
EOF
|
||||
|
|
11
Base/res/devel/templates/cpp-library/Class1.cpp
Normal file
11
Base/res/devel/templates/cpp-library/Class1.cpp
Normal file
|
@ -0,0 +1,11 @@
|
|||
#include "Class1.h"
|
||||
#include <AK/Format.h>
|
||||
|
||||
namespace $LibName {
|
||||
|
||||
void Class1::hello()
|
||||
{
|
||||
out("Hello friends! :^)\n");
|
||||
}
|
||||
|
||||
}
|
10
Base/res/devel/templates/cpp-library/Class1.h
Normal file
10
Base/res/devel/templates/cpp-library/Class1.h
Normal file
|
@ -0,0 +1,10 @@
|
|||
#pragma once
|
||||
|
||||
namespace $LibName {
|
||||
|
||||
class Class1 {
|
||||
public:
|
||||
void hello();
|
||||
};
|
||||
|
||||
}
|
Loading…
Reference in a new issue