Skip to content

Initialized HunspellSpellchecker object with an iconvstr function - #6

Merged
jjallaire merged 5 commits into
rstudio:masterfrom
jeffreyhorner:master
Feb 4, 2012
Merged

jjallaire merged 5 commits into
rstudio:masterfrom
jeffreyhorner:master

Conversation

@jeffreyhorner

Copy link
Copy Markdown
Contributor

A couple of questions on this one:

Should the boost::function<core::Error(const std::string& value, const std::string& from, const std::string& to, bool allowSubstitution, std::string* pResult)> type be typedef'd? And if so, where should it go?

Is there overhead in opening and closing the iconv files every time iconvstr is called? The only time they really need to be opened is when the HunspellSpellchecker object is created. How about caching the dictionary encoding?

…mented encoding enhanced checkSpelling method.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yes, we should typedef the boost::function. I'd say right above the declaration of the createHunspell function in SpellChecker.hpp. Also, in boost::function declarations you can exclude the parameter names (e.g from, to, allowSubstitution, etc. aren't necessary).

Another minor nit: I know I referred to the boost::function construct as a "function pointer" the other day -- this is conceptually true but since it's not actually a C pointer we shouldn't use the p prefix (as in "pIconvStr"). I'd use something like iconvstrFunc instead.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah, yes dropping the p makes total sense. BTW What's the significance of the _ while we're on the subject of pointer names?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The trailing _ indicates a C++ member variable. The only other variable naming convention besides that we have is using s_ as a prefix for statics.

@jeffreyhorner

Copy link
Copy Markdown
Contributor Author

Added another commit.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Typename here should be capitalized

@jeffreyhorner

Copy link
Copy Markdown
Contributor Author

Another commit!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

maybe we should call this copyAndFreeHunspellVector?

jjallaire added a commit that referenced this pull request Feb 4, 2012
Initialized Hunspell Spellchecker object with an iconvstr function
@jjallaire
jjallaire merged commit ce79138 into rstudio:master Feb 4, 2012
@alaimos alaimos mentioned this pull request Apr 24, 2020
4 tasks done
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.

2 participants