
Emoji for C++ developers: converts emoji codes in strings to unicode emojis - delvincasper
https://github.com/shalithasuranga/emojicpp
======
speps
Some issues with this project:

\- non static and non namespaced global variable EMOJIS (should be inside the
emojize method or at least in the namespace)

\- lack of STL use, that std::string replacing code doesn't look very "modern"
at all

\- complete lack of unit tests

\- README has unsupported emojis under the "supported" header

~~~
userbinator
_doesn 't look very "modern" at all_

This is the sort of thing that turns me off C++ completely. It used to be a
pragmatic extension to C, now it's about trend-chasing.

The code could be simpler (the extra "index" which is essentially a state
variable is odd), but IMHO it is otherwise perfectly fine. Useless superficial
criticism like this is just another form of cargo-culting.

~~~
jcelerier
> It used to be a pragmatic extension to C, now it's about trend-chasing.

no, it's about maximizing performance, because C++ libs are what countless
software build upon. Maybe someone will want to use this to display a 4*4k
mural screen with 2000000 of those displayed and changing in real-time. Just
using a <map> instead of a hash-container (there's a compile-time one just on
top of HN right now which would fit the bill perfectly since these are known
at compile time) is already a fairly big smell.

------
huhtenberg
Purely in terms of code readability:

    
    
        -  for (int i = 0; i < sLen; i++) {
        +  for (int i = 0; i < s.size(); i++) {
    
        -      int goBack = i - index + 1 - emo.size();
        -      sLen -= goBack;
        -      i -= goBack;
        -      index = -1;
    
        +      i = index + emo.size();
        +      index = -1;
    

:)

------
torgoguys
FWIW, I'd love to have a browser plugin that does the reverse, converts emojis
it finds on webpages into plain text strings...

(As you might have gathered, I'm not a fan of emojis. Get off my lawn!)

~~~
thrower123
The automatic emoji-fying is my most hated feature in Skype for Business. If
you're copying code snippets around, prepare to get mangled

------
gumby
Nice idea!

You might want to make emojize a template which could handle string, wstring,
string_view, etc.

A fun extension would be to add a flag to istream and ostream that told it to
emojify/demojify output. I.e. use case would be:

    
    
        std::cout << emojicpp::emojify << "here is a string. :smile: !" << std::endl;
        std::cin >> emojicpp::demojify >> some_string;
    

Your stream inserter/extractors could be template functions that take
references to constant string-like objects -- then you wouldn't have to copy
the string and could just output the appropriate data (though you'd need a
lookahead buffer for stuff like these:characters).

------
m_eiman
Why not just use the emoji..?

~~~
wink
Same discussion as when people shifted the encoding of their source code files
from iso to utf-8? :)

I think it's good that you have the most popular encoding for your source and
don't have non-printable characters in there. I'm pretty sure the _majority_
of fonts won't display them correctly. So I'd absolutely prefer to not have
emojis in my code.

------
phuz10n
Thanks! This is pretty cool

