Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Created project layout and csv, conf readers #5

Closed
wants to merge 7 commits into from
Closed

Created project layout and csv, conf readers #5

wants to merge 7 commits into from

Conversation

romitkarmakar
Copy link

No description provided.

Copy link

@xcaptain xcaptain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this pull request is a good proof of concept for casbin, may work but it differs so much from the official go version.

Before contributing I think we should have a code of conduct, like which build tool we use, which coding style to use, which cpp standard to use, which file extension to use etc.

#include<vector>
#include<string>

class CSVManager {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

casbin doesn't read csv file directly, it uses an adapter to read policy, csv file is a kind of adapter.

public:
std::vector<std::string> readLine(std::string);
void readFile(std::string);
void writeFile(std::string);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the writeFile api here has no use because we usually don't edit a csv file.

std::ifstream file(fileName, std::ios::out);
if (!file.is_open())
{
std::cerr << "Error: Unable to open CSV file " << fileName << " for reading!" << std::endl;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

conf file is actually an ini file, not a csv file. The purpose of a conf reader is to construct a model

#include <iostream>
#include "utils.h"

class ExpressionParser
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the purpose of this class?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class is to parse the matcher expression passed in the model conf file

makefile Outdated
@@ -0,0 +1,4 @@
CC = g++
CFLAGS = -std=c++11
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about choosing a cross-platform build tool like cmake so we can build in windows.

@romitkarmakar
Copy link
Author

@xcaptain thank you for your support, I will refactor the whole code according to your suggestions and code of conduct.

@PsiACE PsiACE mentioned this pull request Mar 6, 2020
@romitkarmakar
Copy link
Author

Added CMake and Visual Studio Support.

@hsluoyz
Copy link
Member

hsluoyz commented Mar 7, 2020

See: #7 and my latest commits.

@romitkarmakar
Copy link
Author

@hsluoyz I will add support for makefile and Visual Studio project files support.

@hsluoyz
Copy link
Member

hsluoyz commented Mar 7, 2020

I think contributors should add code based on my latest commits. Like start from: https://github.com/casbin/casbin-cpp/blob/master/casbin/enforcer.cpp

@hsluoyz hsluoyz closed this Mar 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants