Shaders can have lots of different uniform names + attributes. How can I make a system which works in general case so that I do not have to know each shader uniform's name beforehand and hardcode it to code to get its location. I use OpenGL.
Unfortunately, at some point, you'll need to know what the uniform names in the shader are, and what they refer to... there's just no way around that.
Most graphics/game engines work by convention - certain uniforms are set by the engine, and shaders use them as needed. Some will add configuration, so each shader can specify what uniforms it requires, but typically, the names are still done by convention.
Use a naming convention, or parse the shader string yourself to get the type, symbol and optional storage specifier. The former option puts a responsibility on the shader programmer, while the latter solution puts the burden on the application programmer. Such code can be made a lot more elegant and efficient by using the extension GL _ ARB _ uniform _ buffer _ object, which was promoted to core in OpenGL 3.1